mem: multi-clients support for SharedMemoryServer
Record the client session with a map instead of a single unique_ptr so our server can interact with multiple clients at once. This will also avoid a race condition case where the client thought it has closed previous connection and is trying to a new one while the server hasn't clean up the previous entry and raise a fatal error. Change-Id: Id08154fc4b54d2611629875b3f4e0d66c0e2ed92 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/61049 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Yu-hsin Wang <yuhsingw@google.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "base/pollevent.hh"
|
||||
#include "params/SharedMemoryServer.hh"
|
||||
@@ -86,7 +87,8 @@ class SharedMemoryServer : public SimObject
|
||||
|
||||
int serverFd;
|
||||
std::unique_ptr<ListenSocketEvent> listenSocketEvent;
|
||||
std::unique_ptr<ClientSocketEvent> clientSocketEvent;
|
||||
std::unordered_map<int, std::unique_ptr<ClientSocketEvent>>
|
||||
clientSocketEvents;
|
||||
};
|
||||
|
||||
} // namespace memory
|
||||
|
||||
Reference in New Issue
Block a user