Module: kamailio Branch: master Commit: 936baa97ec450b41c1d1c57098d2b463247657e2 URL: https://github.com/kamailio/kamailio/commit/936baa97ec450b41c1d1c57098d2b463...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2016-11-02T13:42:46+01:00
xmpp: shift head of connection list when first is closed
(cherry picked from commit ca4083f37326188cc5c64a148854b239234515df)
---
Modified: modules/xmpp/xmpp_server.c
---
Diff: https://github.com/kamailio/kamailio/commit/936baa97ec450b41c1d1c57098d2b463... Patch: https://github.com/kamailio/kamailio/commit/936baa97ec450b41c1d1c57098d2b463...
---
diff --git a/modules/xmpp/xmpp_server.c b/modules/xmpp/xmpp_server.c index 380dd64..6a9dfbe 100644 --- a/modules/xmpp/xmpp_server.c +++ b/modules/xmpp/xmpp_server.c @@ -451,7 +451,7 @@ int xmpp_server_child_process(int data_pipe) int listen_fd; fd_set fdset; struct xmpp_connection *conn; - + snprintf(local_secret, sizeof(local_secret), "%s", random_secret());
while ((listen_fd = net_listen(xmpp_domain, xmpp_port)) < 0) { @@ -463,13 +463,17 @@ int xmpp_server_child_process(int data_pipe) FD_ZERO(&fdset); FD_SET(data_pipe, &fdset); FD_SET(listen_fd, &fdset); - + /* check for dead connections */ for (conn = conn_list; conn; ) { struct xmpp_connection *next = conn->next;
- if (conn->type == CONN_DEAD) + if (conn->type == CONN_DEAD) { + if(conn == conn_list) { + conn_list = next; + } conn_free(conn); + } conn = next; }
@@ -488,7 +492,7 @@ int xmpp_server_child_process(int data_pipe) } else { conn->type = CONN_DEAD; } - } + }
if (conn->fd != -1) FD_SET(conn->fd, &fdset);