Open smppbox ghost connections...

"Rene Kluwen" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Are quite reproducible:

 

1.       Setup bearerbox + smppbox.

2.       Connect with a second bearerbox via smpp to smppbox.

3.       Disconnect second bearerbox and connect again.

4.       You now have two of the same users connected in first bearerbox
(see status page). One of them doesn't exist.

 

 

See attached patch to fix this.

 

== Rene
ghost.1.patch (application/octet-stream, 1.5 KB)
Index: gw/smppbox.c
===================================================================
--- gw/smppbox.c	(revision 43)
+++ gw/smppbox.c	(working copy)
@@ -399,16 +399,20 @@
     Msg *msg;
 
     pack = NULL;
-    switch (read_from_bearerbox_real(conn, &msg, INFINITE_TIME)) {
-    case -1:
-	// connection to bearerbox lost
-	break;
-    case  0:
-	// all is well
-	break;
-    case  1:
-	// timeout
-	break;
+    while (boxconn->alive) {
+	switch (read_from_bearerbox_real(conn, &msg, 1.0)) {
+	case -1:
+	    /* connection to bearerbox lost */
+	    return NULL;
+	    break;
+	case  0:
+	    /* all is well */
+	    return msg;
+	    break;
+	case  1:
+	    /* timeout */
+	    break;
+	}
     }
 
     return msg;
@@ -1608,7 +1612,7 @@
     if (boxc->smpp_connection)
 	    conn_destroy(boxc->smpp_connection);
     if (boxc->bearerbox_connection)
-	    close_connection_to_bearerbox_real(boxc->bearerbox_connection);
+	    conn_destroy(boxc->bearerbox_connection);
     if (boxc->boxc_id)
 	    octstr_destroy(boxc->boxc_id);
     if (boxc->alt_charset)
@@ -1732,7 +1736,7 @@
 
 	msg = read_from_box(box->bearerbox_connection, box);
         if (msg == NULL) {
-	    if (conn_eof(box->bearerbox_connection)) {
+	    if ((!box->alive) || conn_eof(box->bearerbox_connection)) {
             	/* tell smppbox to die */
 	    	/* the client closes the connection, after that die in receiver */
 	    	box->alive = 0;
@@ -1914,7 +1918,6 @@
 	    boxc_destroy(newconn);
 	    return;
     }
-    /* identify_to_bearerbox(newconn); */
 
     gwlist_append(all_boxes, newconn);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.