Improving NetworkServer's memory management (#373)
This patch resolves several bugs: * NetworkServer would allocate various instances of `NetworkClientInfo`. This is patched by deallocating the NetworkClientInfo when it's listening thread ends in the `listen_done` section. * Memory would be allocated for threads that wouldn't be freed. This is resolved by detaching from the threads, so they no longer need to be joined to be freed, and then freeing the memory as they finish. * Thread-Safety issues involving `ServerClients` would result in stray `NetworkClientInfo`'s not being removed from the list in certain situations. This is resolved by used a mutex to lock access to this from different threads.
This commit is contained in:
parent
263561868c
commit
47baeb6b6b
2 changed files with 38 additions and 12 deletions
|
|
@ -59,6 +59,7 @@ protected:
|
|||
|
||||
std::vector<RGBController *>& controllers;
|
||||
|
||||
std::mutex ServerClientsMutex;
|
||||
std::vector<NetworkClientInfo *> ServerClients;
|
||||
std::thread * ConnectionThread;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue