Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix connect concurrency, can cause connection nodes to close
Looking at the connect code, if 2 threads at the same time try and connect to a node, and both enter sequentially the connectLock code block, the second one would try and put the connection in the map, and close the replaced channels, which will cause the existing connection to close as well (since it removes the node from the connectedNodes map) To fix this, simply make sure we properly check the existence of the connection within the connectionLock block, so there won't be concurrent connections going on. While doing this, also went over all the mutation code that handles disconnections, and made sure they are properly done only within a connection lock. closes #6964
- Loading branch information
Showing
1 changed file
with
38 additions
and
59 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