diff options
Diffstat (limited to 'src/astmanproxy.c')
-rw-r--r-- | src/astmanproxy.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/astmanproxy.c b/src/astmanproxy.c index 282a33e..3c976e6 100644 --- a/src/astmanproxy.c +++ b/src/astmanproxy.c @@ -153,7 +153,6 @@ void destroy_session(struct mansession *s) else sessions = cur->next; debugmsg("Connection closed: %s", ast_inet_ntoa(iabuf, sizeof(iabuf), s->sin.sin_addr)); - close_sock(s->fd); /* close tcp/ssl socket */ pthread_mutex_destroy(&s->lock); free(s); @@ -169,7 +168,7 @@ void destroy_session(struct mansession *s) } int WriteClients(struct message *m) { - struct mansession *c; + struct mansession *c, *d; char *actionid; c = sessions; @@ -182,8 +181,12 @@ int WriteClients(struct message *m) { } } else c->output->write(c, m); - if ( c->input->autodisconnect && c->input->autodisconnect() ) - destroy_session(c); + if ( c->input->autodisconnect && c->input->autodisconnect() ) { + d = c; /* session to disconnect */ + c = c->next; + destroy_session(d); + continue; + } } c = c->next; } |