Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
Better control over tcp connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Voorneveld committed Nov 28, 2016
1 parent b782c8d commit 14e3eb7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Pod/Classes/VSLEndpoint.m
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,10 @@ static void onRegState2(pjsua_acc_id acc_id, pjsua_reg_info *info) {
DDLogVerbose(@"onRegState2");
struct pjsip_regc_cbparam *rp = info->cbparam;

releaseStoredTransport();
if (rp->code/100 == 2 && rp->expiration > 0 && rp->contact_cnt > 0) {
// TCP tranport already saved in onRegStarted
} else {
releaseStoredTransport();
the_transport = rp->rdata->tp_info.transport;
pjsip_transport_add_ref(the_transport);
}

VSLAccount *account = [[VSLEndpoint sharedEndpoint] lookupAccount:acc_id];
Expand All @@ -528,6 +528,8 @@ static void onTransportState(pjsip_transport *tp, pjsip_transport_state state, c
if (state == PJSIP_TP_STATE_DISCONNECTED && the_transport == tp) {
releaseStoredTransport();
}
the_transport = tp;
pjsip_transport_add_ref(tp);
}

static void onIncomingCall(pjsua_acc_id acc_id, pjsua_call_id call_id, pjsip_rx_data *rdata) {
Expand Down Expand Up @@ -571,9 +573,9 @@ static void releaseStoredTransport() {
* @return YES if succesfull
*/
- (BOOL)shutdownTransport {
pj_status_t status;

if (the_transport) {
pj_status_t status;
status = pjsip_transport_shutdown(the_transport);
DDLogInfo(@"Shuting down transport");
if (status != PJ_SUCCESS) {
Expand Down

0 comments on commit 14e3eb7

Please sign in to comment.