- MMS server: initialize maxConnections in IsoServer

pull/72/head
Michael Zillgith 7 years ago
parent 77f97dc006
commit e905bc242b

@ -374,6 +374,7 @@ handleIsoConnections(IsoServer self)
if ((connectionSocket = ServerSocket_accept((ServerSocket) self->serverSocket)) != NULL) { if ((connectionSocket = ServerSocket_accept((ServerSocket) self->serverSocket)) != NULL) {
#if (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1) #if (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1)
if (self->maxConnections > -1) {
if (private_IsoServer_getConnectionCounter(self) >= self->maxConnections) { if (private_IsoServer_getConnectionCounter(self) >= self->maxConnections) {
if (DEBUG_ISO_SERVER) if (DEBUG_ISO_SERVER)
printf("ISO_SERVER: maximum number of connections reached -> reject connection attempt.\n"); printf("ISO_SERVER: maximum number of connections reached -> reject connection attempt.\n");
@ -382,6 +383,7 @@ handleIsoConnections(IsoServer self)
return; return;
} }
}
#endif /* (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1) */ #endif /* (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1) */
#if (CONFIG_MAXIMUM_TCP_CLIENT_CONNECTIONS != -1) #if (CONFIG_MAXIMUM_TCP_CLIENT_CONNECTIONS != -1)
@ -427,6 +429,7 @@ handleIsoConnectionsThreadless(IsoServer self)
if ((connectionSocket = ServerSocket_accept((ServerSocket) self->serverSocket)) != NULL) { if ((connectionSocket = ServerSocket_accept((ServerSocket) self->serverSocket)) != NULL) {
#if (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1) #if (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1)
if (self->maxConnections > -1) {
if (private_IsoServer_getConnectionCounter(self) >= self->maxConnections) { if (private_IsoServer_getConnectionCounter(self) >= self->maxConnections) {
if (DEBUG_ISO_SERVER) if (DEBUG_ISO_SERVER)
printf("ISO_SERVER: maximum number of connections reached -> reject connection attempt.\n"); printf("ISO_SERVER: maximum number of connections reached -> reject connection attempt.\n");
@ -435,6 +438,7 @@ handleIsoConnectionsThreadless(IsoServer self)
return; return;
} }
}
#endif /* (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1) */ #endif /* (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1) */
#if (CONFIG_MAXIMUM_TCP_CLIENT_CONNECTIONS != -1) #if (CONFIG_MAXIMUM_TCP_CLIENT_CONNECTIONS != -1)
@ -522,6 +526,10 @@ IsoServer_create(TLSConfiguration tlsConfiguration)
self->openClientConnections = LinkedList_create(); self->openClientConnections = LinkedList_create();
#endif #endif
#if (CONFIG_MMS_SERVER_CONFIG_SERVICES_AT_RUNTIME == 1)
self->maxConnections = CONFIG_MAXIMUM_TCP_CLIENT_CONNECTIONS;
#endif
#if (CONFIG_MMS_THREADLESS_STACK != 1) && (CONFIG_MMS_SINGLE_THREADED == 0) #if (CONFIG_MMS_THREADLESS_STACK != 1) && (CONFIG_MMS_SINGLE_THREADED == 0)
self->connectionCounterMutex = Semaphore_create(1); self->connectionCounterMutex = Semaphore_create(1);
self->openClientConnectionsMutex = Semaphore_create(1); self->openClientConnectionsMutex = Semaphore_create(1);

Loading…
Cancel
Save