mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-msc.git
synced 2025-11-01 20:43:45 +00:00
smpp: set TCP_NODELAY sockopt
Change-Id: Ibfaaeaa6e21f621eb32b37b783e286e40859c915 Fixes: OS#5568
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#include <smpp34.h>
|
||||
#include <smpp34_structs.h>
|
||||
@@ -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)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#include <smpp34.h>
|
||||
#include <smpp34_structs.h>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user