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
changes/26/28126/1
Harald Welte 7 months ago
parent 022193da73
commit bf254f6da5
  1. 9
      src/libmsc/smpp_smsc.c

@ -347,8 +347,15 @@ int smpp_route(const struct smsc *smsc, const struct osmo_smpp_addr *dest, struc
#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;

Loading…
Cancel
Save