-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Internal refactor of P2P::Session vs. P2P::ManagerXXX classes (#93)
* Replace weak_ptr<Session> with NodeId in Manager* APIs * Fix SonarQube issue * Remove retrieving session object for logging errors * Harden P2P networking shutdown sequence - Rule out any possibility that ManagerBase::sessions_ will grow (or shrink) after ManagerBase::close_ is set to true, so that ManagerBase::stop() can close all registered sessions - On ManagerBase::stop(), join the Session thread pool after Server and ClientFactory are stopped (possibly more correct) * P2P::ManagerBase: - removed closed_; replaced by started_ (ManagerBase should be able to start() and stop() repeatedly and safely) - added stateMutex_ to synchronize start(), stop() and thread pool - start() creates threadPool_ - stop() destroys threadPool_ (waits for all tasks and joins all threads, guaranteeing that there is no session/socket message handling code active when it is time to e.g. destroy the underlying io_context) - threadPool_ is now isolated and not forwarded to other objects; to use the ManagerBase thread pool, other objects have to call a method on ManagerBase that will service the request, such as ManagerBase::asyncHandleMessage() state.cpp (test): - increased timeout from 5s to 120s in a couple of futures to avoid random, performance-related failures (logs to cout if they exceed 5s, which in any case is rare) * add this->
- Loading branch information
Showing
13 changed files
with
253 additions
and
412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.