[asterisk-commits] mnicholson: branch 1.8 r317196 - /branches/1.8/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 5 13:02:57 CDT 2011


Author: mnicholson
Date: Thu May  5 13:02:52 2011
New Revision: 317196

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=317196
Log:
Set SO_KEEPALIVE on SIP TCP sockets so that they eventually go away when a peer
abruptly disappears.  This mostly occurs after a successful registration.

(closes issue #17544)
Reported by: marcelloceschia
Patches:
      (modified) tcptls.patch uploaded by st (license 907)

Modified:
    branches/1.8/channels/chan_sip.c

Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=317196&r1=317195&r2=317196
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Thu May  5 13:02:52 2011
@@ -2524,6 +2524,12 @@
 		}
 	}
 
+	flags = 1;
+	if (setsockopt(tcptls_session->fd, SOL_SOCKET, SO_KEEPALIVE, &flags, sizeof(flags))) {
+		ast_log(LOG_ERROR, "error enabling TCP keep-alives on sip socket: %s\n", strerror(errno));
+		goto cleanup;
+	}
+
 	me->threadid = pthread_self();
 	ast_debug(2, "Starting thread for %s server\n", tcptls_session->ssl ? "SSL" : "TCP");
 




More information about the asterisk-commits mailing list