Changeset 5884 for pjproject/trunk/pjsip/src/pjsip/sip_transport.c
- Timestamp:
- Sep 14, 2018 1:27:32 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_transport.c
r5851 r5884 2120 2120 pjsip_transport_key key; 2121 2121 int key_len; 2122 pjsip_transport *transport ;2122 pjsip_transport *transport = NULL; 2123 2123 2124 2124 /* If listener is specified, verify that the listener type matches … … 2133 2133 } 2134 2134 2135 pj_bzero(&key, sizeof(key)); 2136 key_len = sizeof(key.type) + addr_len; 2137 2138 /* First try to get exact destination. */ 2139 key.type = type; 2140 pj_memcpy(&key.rem_addr, remote, addr_len); 2141 2142 transport = (pjsip_transport*) 2143 pj_hash_get(mgr->table, &key, key_len, NULL); 2144 2145 if (transport == NULL) { 2135 if (!sel || sel->disable_connection_reuse == PJ_FALSE) { 2136 pj_bzero(&key, sizeof(key)); 2137 key_len = sizeof(key.type) + addr_len; 2138 2139 /* First try to get exact destination. */ 2140 key.type = type; 2141 pj_memcpy(&key.rem_addr, remote, addr_len); 2142 2143 transport = (pjsip_transport*) 2144 pj_hash_get(mgr->table, &key, key_len, NULL); 2145 } 2146 2147 if (transport == NULL && 2148 (!sel || sel->disable_connection_reuse == PJ_FALSE)) 2149 { 2146 2150 unsigned flag = pjsip_transport_get_flag_from_type(type); 2147 2151 const pj_sockaddr *remote_addr = (const pj_sockaddr*)remote; … … 2181 2185 /* This will cause a new transport to be created which will be a 2182 2186 * 'duplicate' of the existing transport (same type & remote addr, 2183 * but different factory). Any future hash lookup will return 2184 * the new one, and eventually the old one will still be freed 2185 * (by application or #1774). 2187 * but different factory). 2186 2188 */ 2187 2189 } … … 2201 2203 2202 2204 /* 2203 * Transport not found! 2204 * So we need to create one, find factory that can create 2205 * such transport. 2205 * Either transport not found, or we don't want to use the existing 2206 * transport (such as in the case of different factory or 2207 * if connection reuse is disabled). So we need to create one, 2208 * find factory that can create such transport. 2209 * 2210 * If there's an existing transport, its place in the hash table 2211 * will be replaced by this new one. And eventually the existing 2212 * transport will still be freed (by application or #1774). 2206 2213 */ 2207 2214 if (sel && sel->type == PJSIP_TPSELECTOR_LISTENER && sel->u.listener)
Note: See TracChangeset
for help on using the changeset viewer.