Changeset 107 for pjproject/trunk/pjsip/src/test-pjsip/transport_test.c
- Timestamp:
- Jan 5, 2006 11:35:46 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/test-pjsip/transport_test.c
- Property svn:keywords changed from "Id Revision" to Id
r106 r107 76 76 */ 77 77 #define FROM_HDR "Bob <sip:bob@example.com>" 78 #define TO_HDR "Alice <sip:alice@example.com>"79 78 #define CONTACT_HDR "Bob <sip:bob@127.0.0.1>" 80 79 #define CALL_ID_HDR "SendRecv-Test" … … 109 108 &my_on_rx_request, /* on_rx_request() */ 110 109 &my_on_rx_response, /* on_rx_response() */ 111 NULL, /* tsx_handler() */110 NULL, /* on_tsx_state() */ 112 111 }; 113 112 … … 189 188 int transport_send_recv_test( pjsip_transport_type_e tp_type, 190 189 pjsip_transport *ref_tp, 191 c onst pj_sockaddr_in *rem_addr)190 char *target_url ) 192 191 { 193 192 pj_status_t status; 194 char target_buf[80];195 193 pj_str_t target, from, to, contact, call_id, body; 196 194 pjsip_method method; … … 210 208 211 209 /* Create a request message. */ 212 pj_sprintf(target_buf, "sip:%s:%d", pj_inet_ntoa(rem_addr->sin_addr), 213 pj_ntohs(rem_addr->sin_port)); 214 target = pj_str(target_buf); 210 target = pj_str(target_url); 215 211 from = pj_str(FROM_HDR); 216 to = pj_str( TO_HDR);212 to = pj_str(target_url); 217 213 contact = pj_str(CONTACT_HDR); 218 214 call_id = pj_str(CALL_ID_HDR); … … 334 330 } rt_test_data[16]; 335 331 336 static char rt_target_uri[ 32];332 static char rt_target_uri[64]; 337 333 static pj_bool_t rt_stop; 338 334 static pj_str_t rt_call_id; … … 350 346 status = pjsip_endpt_create_response( endpt, rdata, 200, NULL, &tdata); 351 347 if (status != PJ_SUCCESS) { 348 app_perror(" error creating response", status); 352 349 return PJ_TRUE; 353 350 } 354 351 status = pjsip_get_response_addr( tdata->pool, rdata, &res_addr); 355 352 if (status != PJ_SUCCESS) { 353 app_perror(" error in get response address", status); 356 354 pjsip_tx_data_dec_ref(tdata); 357 355 return PJ_TRUE; … … 359 357 status = pjsip_endpt_send_response( endpt, &res_addr, tdata, NULL, NULL); 360 358 if (status != PJ_SUCCESS) { 359 app_perror(" error sending response", status); 361 360 pjsip_tx_data_dec_ref(tdata); 362 361 return PJ_TRUE; … … 377 376 target = pj_str(rt_target_uri); 378 377 from = pj_str(FROM_HDR); 379 to = pj_str( TO_HDR);378 to = pj_str(rt_target_uri); 380 379 contact = pj_str(CONTACT_HDR); 381 380 call_id = rt_test_data[thread_id].call_id; … … 431 430 static int rt_thread(void *arg) 432 431 { 433 int thread_id = (int)arg;432 int i, thread_id = (int)arg; 434 433 pj_time_val poll_delay = { 0, 10 }; 435 434 … … 444 443 pjsip_endpt_handle_events(endpt, &poll_delay); 445 444 } 445 446 /* Exhaust responses. */ 447 for (i=0; i<100; ++i) 448 pjsip_endpt_handle_events(endpt, &poll_delay); 449 446 450 return 0; 447 451 } … … 449 453 int transport_rt_test( pjsip_transport_type_e tp_type, 450 454 pjsip_transport *ref_tp, 451 c onst pj_sockaddr_in *rem_addr)455 char *target_url ) 452 456 { 453 457 enum { THREADS = 4, INTERVAL = 10 }; … … 484 488 485 489 /* Initialize static test data. */ 486 pj_sprintf(rt_target_uri, "sip:%s:%d", pj_inet_ntoa(rem_addr->sin_addr), 487 pj_ntohs(rem_addr->sin_port)); 490 pj_native_strcpy(rt_target_uri, target_url); 488 491 rt_call_id = pj_str("RT-Call-Id/"); 489 492 rt_stop = PJ_FALSE; … … 552 555 PJ_LOG(3,("", " average round-trip=%d usec", usec_rt)); 553 556 554 pjsip_endpt_ destroy_pool(endpt, pool);557 pjsip_endpt_release_pool(endpt, pool); 555 558 556 559 if (is_reliable && (total_sent != total_recv)) {
Note: See TracChangeset
for help on using the changeset viewer.