[asterisk-commits] qwell: trunk r67157 - in /trunk: ./ channels/chan_skinny.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jun 4 16:29:23 MST 2007


Author: qwell
Date: Mon Jun  4 18:29:22 2007
New Revision: 67157

URL: http://svn.digium.com/view/asterisk?view=rev&rev=67157
Log:
Merged revisions 67156 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r67156 | qwell | 2007-06-04 18:26:28 -0500 (Mon, 04 Jun 2007) | 6 lines

Fix for skinny keepalives.
If there is no traffic from the phone for (keep_alive * 1100) ms (arbitrarily
 adding 10% for network issues, etc),  unregister the device.

Issue 8394, patch by DEA.

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_skinny.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=67157&r1=67156&r2=67157
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Mon Jun  4 18:29:22 2007
@@ -4438,15 +4438,21 @@
  	fds[0].fd = s->fd;
 	fds[0].events = POLLIN;
 	fds[0].revents = 0;
-	res = poll(fds, 1, -1);
-
+	res = poll(fds, 1, (keep_alive * 1100)); /* If nothing has happen, client is dead */
+						 /* we add 10% to the keep_alive to deal */
+						 /* with network delays, etc */
 	if (res < 0) {
-		if (errno != EINTR)
-		{
+		if (errno != EINTR) {
 			ast_log(LOG_WARNING, "Select returned error: %s\n", strerror(errno));
 			return res;
 		}
- 	}
+ 	} else if (res == 0) {
+		if (skinnydebug)
+			ast_verbose("Skinny Client was lost, unregistering\n");
+		skinny_unregister(NULL, s);
+		return -1;
+	}
+		     
 	if (fds[0].revents) {
 		ast_mutex_lock(&s->lock);
 		memset(s->inbuf,0,sizeof(s->inbuf));



More information about the asterisk-commits mailing list