Changeset 1192
- Timestamp:
- Apr 11, 2007 7:48:42 PM (16 years ago)
- Location:
- pjproject/branches/symbian
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/symbian/pjlib/src/pj/addr_resolv_sock.c
r65 r1192 50 50 } 51 51 52 /* Resolve the IP address of local machine */ 53 PJ_DEF(pj_status_t) pj_gethostip(pj_in_addr *addr) 54 { 55 const pj_str_t *hostname = pj_gethostname(); 56 struct pj_hostent he; 57 pj_status_t status; 58 59 60 #ifdef _MSC_VER 61 /* Get rid of "uninitialized he variable" with MS compilers */ 62 pj_memset(&he, 0, sizeof(he)); 63 #endif 64 65 /* Try with resolving local hostname first */ 66 status = pj_gethostbyname(hostname, &he); 67 if (status == PJ_SUCCESS) { 68 *addr = *(pj_in_addr*)he.h_addr; 69 } 70 71 72 /* If we end up with 127.x.x.x, resolve the IP by getting the default 73 * interface to connect to some public host. 74 */ 75 if (status != PJ_SUCCESS || (pj_ntohl(addr->s_addr) >> 24)==127) { 76 pj_sock_t fd; 77 pj_str_t cp; 78 pj_sockaddr_in a; 79 int len; 80 81 status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, &fd); 82 if (status != PJ_SUCCESS) { 83 return status; 84 } 85 86 cp = pj_str("1.1.1.1"); 87 pj_sockaddr_in_init(&a, &cp, 53); 88 89 status = pj_sock_connect(fd, &a, sizeof(a)); 90 if (status != PJ_SUCCESS) { 91 pj_sock_close(fd); 92 /* Return 127.0.0.1 as the address */ 93 return PJ_SUCCESS; 94 } 95 96 len = sizeof(a); 97 status = pj_sock_getsockname(fd, &a, &len); 98 if (status != PJ_SUCCESS) { 99 pj_sock_close(fd); 100 /* Return 127.0.0.1 as the address */ 101 return PJ_SUCCESS; 102 } 103 104 pj_sock_close(fd); 105 106 *addr = a.sin_addr; 107 } 108 109 return status; 110 } 111 112 -
pjproject/branches/symbian/pjlib/src/pj/sock_bsd.c
r788 r1192 633 633 PJ_ASSERT_RETURN(newsock != NULL, PJ_EINVAL); 634 634 635 hello636 637 635 #if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0 638 636 if (addr) { -
pjproject/branches/symbian/pjsip/src/pjsip/sip_transaction.c
r789 r1192 126 126 static const pj_time_val t1_timer_val = { PJSIP_T1_TIMEOUT/1000, 127 127 PJSIP_T1_TIMEOUT%1000 }; 128 static const pj_time_val t2_timer_val = { PJSIP_T2_TIMEOUT/1000, 129 PJSIP_T2_TIMEOUT%1000 }; 128 130 static const pj_time_val t4_timer_val = { PJSIP_T4_TIMEOUT/1000, 129 131 PJSIP_T4_TIMEOUT%1000 }; … … 1704 1706 pj_assert((tsx->transport_flag & TSX_HAS_PENDING_TRANSPORT) == 0); 1705 1707 1706 msec_time = (1 << (tsx->retransmit_count)) * PJSIP_T1_TIMEOUT; 1708 pj_assert(tsx->status_code < 200); 1709 1710 if (tsx->status_code >= 100) 1711 msec_time = PJSIP_T2_TIMEOUT; 1712 else 1713 msec_time = (1 << (tsx->retransmit_count)) * PJSIP_T1_TIMEOUT; 1707 1714 1708 1715 if (tsx->role == PJSIP_ROLE_UAC) { … … 1879 1886 } else if (event->type == PJSIP_EVENT_RX_MSG) { 1880 1887 pjsip_msg *msg; 1881 //int code;1888 int code; 1882 1889 1883 1890 /* Get message instance */ 1884 1891 msg = event->body.rx_msg.rdata->msg_info.msg; 1885 1892 1886 /* Better be a response message. */ 1887 if (msg->type != PJSIP_RESPONSE_MSG) 1888 return PJSIP_ENOTRESPONSEMSG; 1889 1890 /* Cancel retransmission timer A. */ 1891 if (tsx->retransmit_timer._timer_id != -1) { 1892 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 1893 tsx->retransmit_timer._timer_id = -1; 1894 } 1893 code = msg->line.status.code; 1894 1895 /* If the response is final, cancel both retransmission and timeout 1896 * timer. 1897 */ 1898 if (code >= 200) { 1899 if (tsx->retransmit_timer._timer_id != -1) { 1900 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 1901 tsx->retransmit_timer._timer_id = -1; 1902 } 1903 1904 if (tsx->timeout_timer._timer_id != -1) { 1905 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1906 tsx->timeout_timer._timer_id = -1; 1907 } 1908 1909 } else { 1910 /* Cancel retransmit timer (for non-INVITE transaction, the 1911 * retransmit timer will be rescheduled at T2. 1912 */ 1913 if (tsx->retransmit_timer._timer_id != -1) { 1914 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 1915 tsx->retransmit_timer._timer_id = -1; 1916 } 1917 1918 /* For provisional response, only cancel retransmit when this 1919 * is an INVITE transaction. For non-INVITE, section 17.1.2.1 1920 * of RFC 3261 says that: 1921 * - retransmit timer is set to T2 1922 * - timeout timer F is not deleted. 1923 */ 1924 if (tsx->method.id == PJSIP_INVITE_METHOD) { 1925 1926 /* Cancel timeout timer */ 1927 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1928 1929 } else { 1930 if (!tsx->is_reliable) { 1931 pjsip_endpt_schedule_timer(tsx->endpt, 1932 &tsx->retransmit_timer, 1933 &t2_timer_val); 1934 } 1935 } 1936 } 1937 1895 1938 tsx->transport_flag &= ~(TSX_HAS_PENDING_RESCHED); 1896 1897 1898 /* Cancel timer B (transaction timeout) */1899 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer);1900 1939 1901 1940 /* Discard retransmission message if it is not INVITE. … … 2222 2261 tsx->status_code = msg->line.status.code; 2223 2262 } else { 2224 tsx->status_code = PJSIP_SC_TSX_TIMEOUT; 2263 if (event->body.timer.entry == &tsx->retransmit_timer) { 2264 /* Retransmit message. */ 2265 pj_status_t status; 2266 2267 status = tsx_retransmit( tsx, 1 ); 2268 2269 return status; 2270 2271 } else { 2272 tsx->status_code = PJSIP_SC_TSX_TIMEOUT; 2273 } 2225 2274 } 2226 2275 … … 2266 2315 } 2267 2316 2317 } else if (event->type == PJSIP_EVENT_TIMER && 2318 event->body.timer.entry == &tsx->timeout_timer) { 2319 2320 /* Inform TU. */ 2321 tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 2322 PJSIP_EVENT_TIMER, &tsx->timeout_timer); 2323 2324 2268 2325 } else if (tsx->status_code >= 300 && tsx->status_code <= 699) { 2269 2326 -
pjproject/branches/symbian/pjsip/src/pjsua-lib/pjsua_core.c
r452 r1192 494 494 495 495 /* Init caching pool. */ 496 pj_caching_pool_init(&pjsua.cp, &pj_pool_factory_default_policy, 0);496 pj_caching_pool_init(&pjsua.cp, pj_pool_factory_get_default_policy(), 0); 497 497 498 498 /* Create memory pool for application. */
Note: See TracChangeset
for help on using the changeset viewer.