- iso_server.c: fixed bug in multi-threaded version: segfault when conection unexpectedly closed

This commit is contained in:
Michael Zillgith 2016-06-04 21:38:43 +02:00
parent 3696f1f6d9
commit d8ace91bcf
2 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -561,8 +561,11 @@ IsoServer_waitReady(IsoServer self, unsigned int timeoutMs)
if (self->openClientConnections[i] != NULL) { if (self->openClientConnections[i] != NULL) {
if (IsoConnection_isRunning(self->openClientConnections[i])) { if (IsoConnection_isRunning(self->openClientConnections[i])) {
IsoConnection_addHandleSet(self->openClientConnections[i], handles); IsoConnection_addHandleSet(self->openClientConnections[i], handles);
} else { }
else {
#if ((CONFIG_MMS_SINGLE_THREADED == 1) || (CONFIG_MMS_THREADLESS_STACK == 1))
IsoConnection_destroy(self->openClientConnections[i]); IsoConnection_destroy(self->openClientConnections[i]);
#endif
self->openClientConnections[i] = NULL; self->openClientConnections[i] = NULL;
} }
} }