From afd374397d4a81bfcccc59faa2f63218de8149d2 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Sun, 10 Dec 2017 14:14:48 +0100 Subject: [PATCH] - IEC 61850/MMS: allow using default port in non-threaded mode --- src/iec61850/inc/iec61850_server.h | 4 ++-- src/mms/iso_mms/server/mms_server.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/iec61850/inc/iec61850_server.h b/src/iec61850/inc/iec61850_server.h index 9080a6b1..4672c718 100644 --- a/src/iec61850/inc/iec61850_server.h +++ b/src/iec61850/inc/iec61850_server.h @@ -113,7 +113,7 @@ IedServer_setFilestoreBasepath(IedServer self, const char* basepath); * \brief Start handling client connections * * \param self the instance of IedServer to operate on. - * \param tcpPort the TCP port the server is listening + * \param tcpPort the TCP port the server is listening (-1 for using the default MMS or secure MMS port) */ void IedServer_start(IedServer self, int tcpPort); @@ -134,7 +134,7 @@ IedServer_stop(IedServer self); * be called periodically. * * \param self the instance of IedServer to operate on. - * \param tcpPort the TCP port the server is listening + * \param tcpPort the TCP port the server is listening (-1 for using the default MMS or secure MMS port) */ void IedServer_startThreadless(IedServer self, int tcpPort); diff --git a/src/mms/iso_mms/server/mms_server.c b/src/mms/iso_mms/server/mms_server.c index 577590b9..5781812c 100644 --- a/src/mms/iso_mms/server/mms_server.c +++ b/src/mms/iso_mms/server/mms_server.c @@ -394,7 +394,10 @@ void MmsServer_startListeningThreadless(MmsServer self, int tcpPort) { IsoServer_setConnectionHandler(self->isoServer, isoConnectionIndicationHandler, (void*) self); - IsoServer_setTcpPort(self->isoServer, tcpPort); + + if (tcpPort != -1) + IsoServer_setTcpPort(self->isoServer, tcpPort); + IsoServer_startListeningThreadless(self->isoServer); }