Changeset 5991
- Timestamp:
- May 15, 2019 2:54:52 AM (5 years ago)
- Location:
- pjproject/trunk/pjsip/src/pjsip
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_transport_tls.c
r5984 r5991 163 163 const pj_sockaddr *remote, 164 164 const pj_str_t *remote_name, 165 pj_grp_lock_t *glock, 165 166 struct tls_transport **p_tls); 166 167 … … 787 788 const pj_sockaddr *remote, 788 789 const pj_str_t *remote_name, 790 pj_grp_lock_t *glock, 789 791 struct tls_transport **p_tls) 790 792 { … … 870 872 871 873 tls->ssock = ssock; 874 875 /* Set up the group lock */ 876 tls->grp_lock = tls->base.grp_lock = glock; 877 pj_grp_lock_add_ref(tls->grp_lock); 878 pj_grp_lock_add_handler(tls->grp_lock, pool, tls, &tls_on_destroy); 872 879 873 880 /* Register transport to transport manager */ … … 1227 1234 /* Create the transport descriptor */ 1228 1235 status = tls_create(listener, pool, ssock, PJ_FALSE, &local_addr, 1229 rem_addr, &remote_name, &tls); 1230 if (status != PJ_SUCCESS) { 1231 pj_grp_lock_destroy(glock); 1236 rem_addr, &remote_name, glock, &tls); 1237 if (status != PJ_SUCCESS) 1232 1238 return status; 1233 }1234 1239 1235 1240 /* Set the "pending" SSL socket user data */ 1236 1241 pj_ssl_sock_set_user_data(tls->ssock, tls); 1237 1238 /* Set up the group lock */1239 tls->grp_lock = tls->base.grp_lock = glock;1240 pj_grp_lock_add_ref(tls->grp_lock);1241 pj_grp_lock_add_handler(tls->grp_lock, pool, tls, &tls_on_destroy);1242 1242 1243 1243 /* Start asynchronous connect() operation */ … … 1394 1394 */ 1395 1395 status = tls_create( listener, NULL, new_ssock, PJ_TRUE, 1396 &ssl_info.local_addr, &tmp_src_addr, NULL, &tls); 1396 &ssl_info.local_addr, &tmp_src_addr, NULL, 1397 ssl_info.grp_lock, &tls); 1397 1398 1398 1399 if (status != PJ_SUCCESS) { … … 1410 1411 /* Set the "pending" SSL socket user data */ 1411 1412 pj_ssl_sock_set_user_data(new_ssock, tls); 1412 1413 /* Set up the group lock */1414 if (ssl_info.grp_lock) {1415 tls->grp_lock = ssl_info.grp_lock;1416 pj_grp_lock_add_ref(tls->grp_lock);1417 pj_grp_lock_add_handler(tls->grp_lock, tls->base.pool, tls,1418 &tls_on_destroy);1419 }1420 1413 1421 1414 /* Prevent immediate transport destroy as application may access it -
pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c
r5984 r5991 471 471 } 472 472 473 /* When creating this transport, reference count was incremented to flag 474 * this transport as permanent so it will not be destroyed by transport 475 * manager whenever idle. Application may or may not have cleared the 476 * flag (by calling pjsip_transport_dec_ref()), so in case it has not, 477 * let's do it now, so this transport can be destroyed. 478 */ 479 if (pj_atomic_get(tp->base.ref_cnt) > 0) 480 pjsip_transport_dec_ref(&tp->base); 481 482 /* Destroy transport */ 473 483 if (tp->grp_lock) { 474 484 pj_grp_lock_t *grp_lock = tp->grp_lock; … … 845 855 tp->base.destroy = &udp_destroy; 846 856 847 /* This is a permanent transport, so we initialize the ref count848 * to one so that transport manager don't destroy this transport849 * when there's no user!850 */851 pj_atomic_inc(tp->base.ref_cnt);852 853 857 /* Register to transport manager. */ 854 858 tp->base.tpmgr = pjsip_endpt_get_tpmgr(endpt); … … 857 861 goto on_error; 858 862 863 /* This is a permanent transport, so we initialize the ref count 864 * to one so that transport manager won't destroy this transport 865 * when there's no user! 866 */ 867 pjsip_transport_add_ref(&tp->base); 859 868 860 869 /* Create rdata and put it in the array. */
Note: See TracChangeset
for help on using the changeset viewer.