summaryrefslogtreecommitdiff
path: root/channels/chan_skinny.c
diff options
context:
space:
mode:
authorJason Parker <jparker@digium.com>2007-06-04 23:29:22 +0000
committerJason Parker <jparker@digium.com>2007-06-04 23:29:22 +0000
commit95327fdb2f0933bd9b73e3162d04c417098a4253 (patch)
tree29c2d585fd9f1874a4d894e2985689f0c47db7c7 /channels/chan_skinny.c
parent8611e870bbd3982c138815a062af5264e373888a (diff)
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. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67157 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_skinny.c')
-rw-r--r--channels/chan_skinny.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 3ef4a4b93..fec60f790 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -4438,15 +4438,21 @@ static int get_input(struct skinnysession *s)
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));