- fixed performance problem (removed Thread_sleep()) for single and multithreaded server

pull/6/head
Michael Zillgith 10 years ago
parent c5f9612593
commit 833765bbb2

@ -36,7 +36,7 @@
* 0 ==> server runs in multi-threaded mode (one thread for each connection and * 0 ==> server runs in multi-threaded mode (one thread for each connection and
* one server background thread ) * one server background thread )
*/ */
#define CONFIG_MMS_SINGLE_THREADED 1 #define CONFIG_MMS_SINGLE_THREADED 0
/* /*
* Optimize stack for threadless operation - don't use semaphores * Optimize stack for threadless operation - don't use semaphores

@ -485,15 +485,12 @@ singleThreadedServerThread(void* parameter)
while (running) { while (running) {
if (IedServer_waitReady(self, 25) > 0) { if (IedServer_waitReady(self, 25) > 0)
MmsServer_handleIncomingMessages(self->mmsServer); MmsServer_handleIncomingMessages(self->mmsServer);
IedServer_performPeriodicTasks(self); IedServer_performPeriodicTasks(self);
}
else {
IedServer_performPeriodicTasks(self);
}
Thread_sleep(1); //Thread_sleep(1);
running = mmsMapping->reportThreadRunning; running = mmsMapping->reportThreadRunning;
} }

@ -1,7 +1,7 @@
/* /*
* reporting.c * reporting.c
* *
* Copyright 2013, 2014 Michael Zillgith * Copyright 2013 - 2016 Michael Zillgith
* *
* This file is part of libIEC61850. * This file is part of libIEC61850.
* *

@ -130,6 +130,11 @@ IsoConnection_addHandleSet(const IsoConnection self, HandleSet handles)
void void
IsoConnection_handleTcpConnection(IsoConnection self) IsoConnection_handleTcpConnection(IsoConnection self)
{ {
#if (CONFIG_MMS_SINGLE_THREADED == 0)
if (IsoServer_waitReady(self->isoServer, 10) < 1)
return;
#endif /* (CONFIG_MMS_SINGLE_THREADED == 0) */
TpktState tpktState = CotpConnection_readToTpktBuffer(self->cotpConnection); TpktState tpktState = CotpConnection_readToTpktBuffer(self->cotpConnection);
if (tpktState == TPKT_ERROR) if (tpktState == TPKT_ERROR)
@ -430,7 +435,7 @@ handleTcpConnection(void* parameter)
while(self->state == ISO_CON_STATE_RUNNING) { while(self->state == ISO_CON_STATE_RUNNING) {
IsoConnection_handleTcpConnection(self); IsoConnection_handleTcpConnection(self);
Thread_sleep(1); // Thread_sleep(1);
} }
finalizeIsoConnection(self); finalizeIsoConnection(self);

Loading…
Cancel
Save