ChainSafe / ChainSafe/gossamer
fix the use of setMutex and getMutex in network package
- Dominant language
- Go
- Stars
- 454
- Forks
- 144
- PR merge metrics
- No merged PRs in 30d
Description
## Issue summary
- setMutex is used to set peer based mutexes. We use this mutexes to make sure that we are not trying to establish multiple connections with the same peer with the same protocol.
- Currently setMutex gets used at random places. Ideally, mutex should be set using a connection handler. And we should set this connection handler when a notification protocol gets registered.
https://github.com/ChainSafe/gossamer/blob/972438112f4eddd8d281b358d1b1fae31fd70517/dot/network/service.go#L299-L316
- Making sure that we create this connection handler after adding all the notification protocols would solve the problem.
- Currently, grandpa protocol and parachain's protocols get registered after this connection handler. Which would be causing the problem.
## Other information and links
- Inspired from this discussion https://github.com/ChainSafe/gossamer/pull/3827#discussion_r1547835400
Contributor guide
Assessment
This issue has not been assessed yet.