Changeset 600
- Timestamp:
- Jul 10, 2006 9:37:53 PM (18 years ago)
- Location:
- pjproject/trunk/pjsip/src/pjsip
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r575 r600 1523 1523 err =pj_strerror(-sent, errmsg, sizeof(errmsg)); 1524 1524 1525 PJ_LOG( 4,(tsx->obj_name,1525 PJ_LOG(2,(tsx->obj_name, 1526 1526 "Failed to send %s! err=%d (%s)", 1527 1527 pjsip_tx_data_get_info(send_state->tdata), -sent, … … 1546 1546 char errmsg[PJ_ERR_MSG_SIZE]; 1547 1547 1548 PJ_LOG( 4,(tsx->obj_name,1548 PJ_LOG(2,(tsx->obj_name, 1549 1549 "Temporary failure in sending %s, " 1550 1550 "will try next server. Err=%d (%s)", … … 1572 1572 err = pj_strerror(-sent, errmsg, sizeof(errmsg)); 1573 1573 1574 PJ_LOG( 4,(tsx->obj_name, "Transport failed to send %s! Err=%d (%s)",1574 PJ_LOG(2,(tsx->obj_name, "Transport failed to send %s! Err=%d (%s)", 1575 1575 pjsip_tx_data_get_info(tdata), -sent, errmsg)); 1576 1576 … … 1619 1619 char errmsg[PJ_ERR_MSG_SIZE]; 1620 1620 1621 PJ_LOG( 4,(tsx->obj_name,1621 PJ_LOG(2,(tsx->obj_name, 1622 1622 "Error sending %s: Err=%d (%s)", 1623 1623 pjsip_tx_data_get_info(tdata), status, … … 1664 1664 err = pj_strerror(status, errmsg, sizeof(errmsg)); 1665 1665 1666 PJ_LOG( 4,(tsx->obj_name,1666 PJ_LOG(2,(tsx->obj_name, 1667 1667 "Transport error, terminating transaction. " 1668 1668 "Err=%d (%s)", … … 2415 2415 2416 2416 /* Start Timer D with TD/T4 timer if unreliable transport is used. */ 2417 if (PJSIP_TRANSPORT_IS_RELIABLE(tsx->transport) == 0) { 2417 /* Note: tsx->transport may be NULL! */ 2418 if ((tsx->transport && PJSIP_TRANSPORT_IS_RELIABLE(tsx->transport)==0) 2419 || ((tsx->transport_flag & PJSIP_TRANSPORT_RELIABLE) == 0)) 2420 { 2418 2421 if (tsx->method.id == PJSIP_INVITE_METHOD) { 2419 2422 timeout = td_timer_val; -
pjproject/trunk/pjsip/src/pjsip/sip_transport.c
r596 r600 465 465 if (tdata->is_pending) { 466 466 pj_assert(!"Invalid operation step!"); 467 PJ_LOG(2,(THIS_FILE, "Unable to send %s: message is pending", 468 pjsip_tx_data_get_info(tdata))); 467 469 return PJSIP_EPENDINGTX; 468 470 } -
pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c
r582 r600 54 54 pj_ioqueue_op_key_t op_key; 55 55 struct tcp_listener *listener; 56 unsigned index; 57 pj_pool_t *pool; 56 58 pj_sock_t new_sock; 57 59 int addr_len; … … 75 77 pj_ioqueue_key_t *key; 76 78 unsigned async_cnt; 77 struct pending_accept 79 struct pending_accept *accept_op[MAX_ASYNC_CNT]; 78 80 }; 79 81 … … 144 146 /* Common function to create and initialize transport */ 145 147 static pj_status_t tcp_create(struct tcp_listener *listener, 148 pj_pool_t *pool, 146 149 pj_sock_t sock, pj_bool_t is_server, 147 150 const pj_sockaddr_in *local, … … 298 301 299 302 for (i=0; i<async_cnt; ++i) { 300 pj_ioqueue_op_key_init(&listener->accept_op[i].op_key, 301 sizeof(listener->accept_op[i].op_key)); 302 listener->accept_op[i].listener = listener; 303 304 on_accept_complete(listener->key, &listener->accept_op[i].op_key, 303 pj_pool_t *pool; 304 305 pool = pjsip_endpt_create_pool(endpt, "tcps%p", POOL_TP_INIT, 306 POOL_TP_INIT); 307 if (!pool) { 308 status = PJ_ENOMEM; 309 goto on_error; 310 } 311 312 listener->accept_op[i] = pj_pool_zalloc(pool, 313 sizeof(struct pending_accept)); 314 pj_ioqueue_op_key_init(&listener->accept_op[i]->op_key, 315 sizeof(listener->accept_op[i]->op_key)); 316 listener->accept_op[i]->listener = listener; 317 listener->accept_op[i]->index = i; 318 319 on_accept_complete(listener->key, &listener->accept_op[i]->op_key, 305 320 listener->sock, PJ_EPENDING); 306 321 } … … 326 341 { 327 342 struct tcp_listener *listener = (struct tcp_listener *)factory; 343 unsigned i; 328 344 329 345 if (listener->is_registered) { … … 346 362 pj_lock_destroy(listener->factory.lock); 347 363 listener->factory.lock = NULL; 364 } 365 366 for (i=0; i<PJ_ARRAY_SIZE(listener->accept_op); ++i) { 367 if (listener->accept_op[i] && listener->accept_op[i]->pool) { 368 pj_pool_release(listener->accept_op[i]->pool); 369 listener->accept_op[i]->pool = NULL; 370 } 348 371 } 349 372 … … 409 432 */ 410 433 static pj_status_t tcp_create( struct tcp_listener *listener, 434 pj_pool_t *pool, 411 435 pj_sock_t sock, pj_bool_t is_server, 412 436 const pj_sockaddr_in *local, … … 415 439 { 416 440 struct tcp_transport *tcp; 417 pj_pool_t *pool;418 441 pj_ioqueue_t *ioqueue; 419 442 pj_ioqueue_callback tcp_callback; … … 424 447 425 448 426 pool = pjsip_endpt_create_pool(listener->endpt, "tcp", 427 POOL_TP_INIT, POOL_TP_INC); 428 PJ_ASSERT_RETURN(pool != NULL, PJ_ENOMEM); 429 449 if (pool == NULL) { 450 pool = pjsip_endpt_create_pool(listener->endpt, "tcp", 451 POOL_TP_INIT, POOL_TP_INC); 452 PJ_ASSERT_RETURN(pool != NULL, PJ_ENOMEM); 453 } 430 454 431 455 /* … … 684 708 PJ_IOQUEUE_ALWAYS_ASYNC); 685 709 if (status != PJ_SUCCESS && status != PJ_EPENDING) { 686 tcp_perror(tcp->base.obj_name, "ioqueue recv() error", status); 710 PJ_LOG(4, (tcp->base.obj_name, "ioqueue recv() error, status=%d", 711 status)); 687 712 return status; 688 713 } … … 745 770 746 771 /* Create the transport descriptor */ 747 status = tcp_create(listener, sock, PJ_FALSE, &local_addr,772 status = tcp_create(listener, NULL, sock, PJ_FALSE, &local_addr, 748 773 (pj_sockaddr_in*)rem_addr, &tcp); 749 774 if (status != PJ_SUCCESS) … … 846 871 847 872 } else { 873 pj_pool_t *pool; 874 struct pending_accept *new_op; 848 875 849 876 if (sock == PJ_INVALID_SOCKET) { 850 877 sock = accept_op->new_sock; 851 PJ_LOG(4,(listener->obj_name, 852 "Warning: ioqueue reports -1 in on_accept_complete()" 853 " sock argument")); 878 } 879 880 if (sock == PJ_INVALID_SOCKET) { 881 pj_assert(!"Should not happen. status should be error"); 882 goto next_accept; 854 883 } 855 884 … … 864 893 sock)); 865 894 895 /* Create new accept_opt */ 896 pool = pjsip_endpt_create_pool(listener->endpt, "tcps%p", 897 POOL_TP_INIT, POOL_TP_INC); 898 new_op = pj_pool_zalloc(pool, sizeof(struct pending_accept)); 899 new_op->pool = pool; 900 new_op->listener = listener; 901 new_op->index = accept_op->index; 902 pj_ioqueue_op_key_init(&new_op->op_key, sizeof(new_op->op_key)); 903 listener->accept_op[accept_op->index] = new_op; 904 866 905 /* 867 906 * Incoming connections! 868 907 * Create TCP transport for the new socket. 869 908 */ 870 status = tcp_create( listener, sock, PJ_TRUE,909 status = tcp_create( listener, accept_op->pool, sock, PJ_TRUE, 871 910 &accept_op->local_addr, 872 911 &accept_op->remote_addr, &tcp); … … 878 917 } 879 918 } 919 920 accept_op = new_op; 880 921 } 881 922 923 next_accept: 882 924 /* 883 925 * Start the next asynchronous accept() operation. … … 1129 1171 { 1130 1172 1131 /* Report error to endpoint. */ 1132 PJSIP_ENDPT_LOG_ERROR((rdata->tp_info.transport->endpt, 1133 rdata->tp_info.transport->obj_name, 1134 -bytes_read, "TCP recv() error")); 1173 /* Socket error. */ 1135 1174 1136 1175 /* We can not destroy the transport since high level objects may … … 1173 1212 1174 1213 } else { 1175 /* Report error to endpoint */ 1176 PJSIP_ENDPT_LOG_ERROR((rdata->tp_info.transport->endpt, 1177 rdata->tp_info.transport->obj_name, 1178 status, "tcp recv() error")); 1214 /* Socket error */ 1179 1215 1180 1216 /* We can not destroy the transport since high level objects may
Note: See TracChangeset
for help on using the changeset viewer.