fix clearing _Client[]

This commit is contained in:
david gauchard
2020-11-22 22:06:18 +01:00
committed by Markus
parent 52547ec47c
commit e7ab913693

View File

@ -98,15 +98,10 @@ void WebSocketsServerCore::close(void) {
_runnning = false;
disconnect();
// reset _clients[]
// restore _clients[] to their initial state
// before next call to ::begin()
for (int i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
WSclient_t * client = &_clients[i];
// reset instance:
// destructor in place
client->~WSclient_t();
// constructor in place (reset Strings, set scalars to 0)
new (client) WSclient_t;
_clients[i] = WSclient_t();
}
}