Skip to content
Snippets Groups Projects
Commit 90766f95 authored by François-Simon Fauteux-Chapleau's avatar François-Simon Fauteux-Chapleau Committed by Adrien Béraud
Browse files

conversation: fix bug related to use of shut down swarm manager

The SwarmManager class uses the 'isShutdown_' variable to keep track of
whether it has been shut down or not. This variable needs to be reset to
false if we want to restart using a SwarmManager after it was shut down,
which we sometimes do when bootstrapping a conversation.

This patch fixes a failure in
ConversationRequestTest::testBanContactRestartAccount that was
introduced by commit eb4213d3.
GitLab: #1002

Change-Id: If5d295cbae4edd9e2292d7464e2eb2939b05eedb
parent 04daac10
No related branches found
No related tags found
No related merge requests found
......@@ -2339,6 +2339,7 @@ Conversation::bootstrap(std::function<void()> onBootstraped,
pimpl_->checkedMembers_.clear();
// If is shutdown, the conversation was re-added, causing no new nodes to be connected, but just a classic connectivity change
if (pimpl_->swarmManager_->isShutdown()) {
pimpl_->swarmManager_->restart();
pimpl_->swarmManager_->maintainBuckets();
} else if (!pimpl_->swarmManager_->setKnownNodes(devices)) {
fallback(this, true);
......
......@@ -146,6 +146,12 @@ SwarmManager::shutdown()
routing_table.shutdownAllNodes();
}
void
SwarmManager::restart()
{
isShutdown_ = false;
}
bool
SwarmManager::addKnownNode(const NodeId& nodeId)
{
......
......@@ -112,6 +112,14 @@ public:
*/
void shutdown();
/**
* Restart the swarm manager.
*
* This function must be called in situations where we want
* to use a swarm manager that was previously shut down.
*/
void restart();
/**
* Display swarm manager info
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment