diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-04 23:26:28 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-06-04 23:26:28 +0000 |
commit | 35ea3666f22fb139bac034078165337eeeee799e (patch) | |
tree | 2e393cc421655c56afaa517a5bef41e573a06108 /channels | |
parent | edb93e28b1399d2b4c703e4b95742c6390e6ed43 (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.4@67156 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_skinny.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index 1a4c10d54..c84baf3d9 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -4216,15 +4216,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)); |