diff --git a/src/libsmpputil/smpp_smsc.c b/src/libsmpputil/smpp_smsc.c index 34e24c513..786efa188 100644 --- a/src/libsmpputil/smpp_smsc.c +++ b/src/libsmpputil/smpp_smsc.c @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -984,7 +985,7 @@ static void smpp_smsc_stop(struct smsc *smsc) */ int smpp_smsc_start(struct smsc *smsc, const char *bind_addr, uint16_t port) { - int rc; + int rc, val; LOGP(DSMPP, LOGL_NOTICE, "SMPP at %s %d\n", bind_addr ? bind_addr : "0.0.0.0", port ? port : SMPP_PORT); @@ -995,6 +996,11 @@ int smpp_smsc_start(struct smsc *smsc, const char *bind_addr, uint16_t port) if (rc < 0) return rc; + val = 1; + rc = setsockopt(smsc->listen_ofd.fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)); + if (rc < 0) + LOGP(DSMPP, LOGL_ERROR, "Failed to set TCP_NODELAY: %s\n", strerror(errno)); + /* store new address and port */ rc = smpp_smsc_conf(smsc, bind_addr, port ? port : SMPP_PORT); if (rc) diff --git a/src/utils/smpp_mirror.c b/src/utils/smpp_mirror.c index 340e94f0f..5df09e471 100644 --- a/src/utils/smpp_mirror.c +++ b/src/utils/smpp_mirror.c @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -241,7 +242,7 @@ static int esme_write_cb(struct osmo_fd *ofd, struct msgb *msg) static int smpp_esme_init(struct esme *esme, const char *host, uint16_t port) { - int rc; + int rc, val; if (port == 0) port = SMPP_PORT; @@ -255,6 +256,11 @@ static int smpp_esme_init(struct esme *esme, const char *host, uint16_t port) if (rc < 0) return rc; + val = 1; + rc = setsockopt(esme->wqueue.bfd.fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)); + if (rc < 0) + LOGP(DSMPP, LOGL_ERROR, "Failed to set TCP_NODELAY: %s\n", strerror(errno)); + return bind_transceiver(esme); }