Changeset 2781
- Timestamp:
- Jun 22, 2009 2:06:40 PM (15 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/symbian_ua/ua.cpp
r2506 r2781 52 52 //#define SIP_PROXY "<sip:192.168.0.8;lr>" 53 53 54 // 55 // Set to 1 if TCP is desired (experimental) 56 // 57 #define ENABLE_SIP_TCP 0 54 58 55 59 // … … 379 383 status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &tcfg, &tid); 380 384 if (status != PJ_SUCCESS) { 381 pjsua_perror(THIS_FILE, "Error creating transport", status);385 pjsua_perror(THIS_FILE, "Error creating UDP transport", status); 382 386 pjsua_destroy(); 383 387 return status; 384 388 } 385 389 390 /* Add TCP transport */ 391 #if ENABLE_SIP_TCP 392 pjsua_transport_config_default(&tcfg); 393 tcfg.port = SIP_PORT; 394 status = pjsua_transport_create(PJSIP_TRANSPORT_TCP, &tcfg, &tid); 395 if (status != PJ_SUCCESS) { 396 pjsua_perror(THIS_FILE, "Error creating TCP transport", status); 397 pjsua_destroy(); 398 return status; 399 } 400 #endif 401 386 402 /* Add account for the transport */ 387 403 pjsua_acc_add_local(tid, PJ_TRUE, &g_acc_id); -
pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c
r2394 r2781 806 806 sizeof(pj_sockaddr_in)); 807 807 if (status == PJ_SUCCESS) { 808 tcp->has_pending_connect = PJ_FALSE;808 on_connect_complete(tcp->asock, PJ_SUCCESS); 809 809 } else if (status != PJ_EPENDING) { 810 810 tcp_destroy(&tcp->base, status); … … 812 812 } 813 813 814 /* Update (again) local address, just in case local address currently 815 * set is different now that asynchronous connect() is started. 816 */ 817 addr_len = sizeof(pj_sockaddr_in); 818 if (pj_sock_getsockname(sock, &local_addr, &addr_len)==PJ_SUCCESS) { 819 pj_sockaddr_in *tp_addr = (pj_sockaddr_in*)&tcp->base.local_addr; 820 821 /* Some systems (like old Win32 perhaps) may not set local address 822 * properly before socket is fully connected. 814 if (tcp->has_pending_connect) { 815 /* Update (again) local address, just in case local address currently 816 * set is different now that asynchronous connect() is started. 823 817 */ 824 if (tp_addr->sin_addr.s_addr != local_addr.sin_addr.s_addr && 825 local_addr.sin_addr.s_addr != 0) 826 { 827 tp_addr->sin_addr.s_addr = local_addr.sin_addr.s_addr; 828 tp_addr->sin_port = local_addr.sin_port; 829 sockaddr_to_host_port(tcp->base.pool, &tcp->base.local_name, 830 &local_addr); 818 addr_len = sizeof(pj_sockaddr_in); 819 if (pj_sock_getsockname(sock, &local_addr, &addr_len)==PJ_SUCCESS) { 820 pj_sockaddr_in *tp_addr = (pj_sockaddr_in*)&tcp->base.local_addr; 821 822 /* Some systems (like old Win32 perhaps) may not set local address 823 * properly before socket is fully connected. 824 */ 825 if (tp_addr->sin_addr.s_addr != local_addr.sin_addr.s_addr && 826 local_addr.sin_addr.s_addr != 0) 827 { 828 tp_addr->sin_addr.s_addr = local_addr.sin_addr.s_addr; 829 tp_addr->sin_port = local_addr.sin_port; 830 sockaddr_to_host_port(tcp->base.pool, &tcp->base.local_name, 831 &local_addr); 832 } 831 833 } 832 } 833 834 if (tcp->has_pending_connect) { 834 835 835 PJ_LOG(4,(tcp->base.obj_name, 836 836 "TCP transport %.*s:%d is connecting to %.*s:%d...",
Note: See TracChangeset
for help on using the changeset viewer.