Patch to fix the SMPP online times bug. conn->connect_time is a share variable amongst threads and is not protected.
This patch works for us. (FYI the large online times one sees is the unix timestamp time)
Nisan
--- ../cvs/gateway/gw/smsc/smsc_smpp.c Mon Feb 16 22:26:34 2004
+++ gw/smsc/smsc_smpp.c Fri Mar 5 00:17:04 2004
@@ -1197,8 +1197,10 @@
smpp->quitting = 1;
} else {
*pending_submits = 0;
+ mutex_lock(smpp->conn->flow_mutex);
smpp->conn->status = SMSCCONN_ACTIVE;
smpp->conn->connect_time = time(NULL);
+ mutex_unlock(smpp->conn->flow_mutex);
bb_smscconn_connected(smpp->conn);
}
break;
@@ -1215,8 +1217,10 @@
smpp->quitting = 1;
} else {
*pending_submits = 0;
+ mutex_lock(smpp->conn->flow_mutex);
smpp->conn->status = SMSCCONN_ACTIVE;
smpp->conn->connect_time = time(NULL);
+ mutex_unlock(smpp->conn->flow_mutex);
bb_smscconn_connected(smpp->conn);
}
break;
@@ -1234,8 +1238,10 @@
} else {
/* set only resceive status if no transmitt is bind */
if (smpp->conn->status != SMSCCONN_ACTIVE) {
+ mutex_lock(smpp->conn->flow_mutex);
smpp->conn->status = SMSCCONN_ACTIVE_RECV;
smpp->conn->connect_time = time(NULL);
+ mutex_unlock(smpp->conn->flow_mutex);
}
}
break;
