don't try to send events to dead sessions
authorKevin P. Fleming <kpfleming@digium.com>
Thu, 13 Oct 2005 23:29:24 +0000 (23:29 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Thu, 13 Oct 2005 23:29:24 +0000 (23:29 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6776 65c4cc65-6c06-0410-ace0-fbb531ad65f3

manager.c

index bc02a7b..55120e9 100755 (executable)
--- a/manager.c
+++ b/manager.c
@@ -1506,10 +1506,12 @@ int manager_event(int category, char *event, char *fmt, ...)
                ast_mutex_lock(&s->__lock);
                if (s->busy) {
                        append_event(s, tmp);
-               } else if (ast_carefulwrite(s->fd, tmp, tmp_next - tmp, s->writetimeout) < 0) {
-                       ast_log(LOG_WARNING, "Disconnecting slow (or gone) manager session!\n");
-                       s->dead = 1;
-                       pthread_kill(s->t, SIGURG);
+               } else if (!s->dead) {
+                       if (ast_carefulwrite(s->fd, tmp, tmp_next - tmp, s->writetimeout) < 0) {
+                               ast_log(LOG_WARNING, "Disconnecting slow (or gone) manager session!\n");
+                               s->dead = 1;
+                               pthread_kill(s->t, SIGURG);
+                       }
                }
                ast_mutex_unlock(&s->__lock);
        }