Module: kamailio
Branch: 4.4
Commit: ca4083f37326188cc5c64a148854b239234515df
URL:
https://github.com/kamailio/kamailio/commit/ca4083f37326188cc5c64a148854b23…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-11-02T13:41:59+01:00
xmpp: shift head of connection list when first is closed
---
Modified: modules/xmpp/xmpp_server.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ca4083f37326188cc5c64a148854b23…
Patch:
https://github.com/kamailio/kamailio/commit/ca4083f37326188cc5c64a148854b23…
---
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);