laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/28126 )
Change subject: smpp: don't enqueue write messages if ESME is disconnected ......................................................................
smpp: don't enqueue write messages if ESME is disconnected
If the ESME has been disconnected (dead socket) but still is in memory (other users hold a use count), we shouldn't enqueue messages to the write queue.
This prevents messages like DSMPP write_queue.c:112 wqueue(0x7f8bc392f6e0) is full. Rejecting msgb
Change-Id: I10a270f1d555782be272f4d78da43190618a9950 Closes: OS#3278 --- M src/libmsc/smpp_smsc.c 1 file changed, 8 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/26/28126/1
diff --git a/src/libmsc/smpp_smsc.c b/src/libmsc/smpp_smsc.c index 6712032..34391c2 100644 --- a/src/libmsc/smpp_smsc.c +++ b/src/libmsc/smpp_smsc.c @@ -347,8 +347,15 @@ #define PACK_AND_SEND(esme, ptr) pack_and_send(esme, (ptr)->command_id, ptr) static int pack_and_send(struct osmo_esme *esme, uint32_t type, void *ptr) { - struct msgb *msg = msgb_alloc(4096, "SMPP_Tx"); + struct msgb *msg; int rc, rlen; + + /* the socket was closed. Avoid allocating + enqueueing msgb, see + * https://osmocom.org/issues/3278 */ + if (esme->wqueue.bfd.fd == -1) + return -EIO; + + msg = msgb_alloc(4096, "SMPP_Tx"); if (!msg) return -ENOMEM;