Skip to content

Commit

Permalink
Use provided functions to get connection to prevent deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr0llx committed Mar 1, 2024
1 parent 4e7ca94 commit 0879c03
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions hub/hub_pairing.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,9 @@ func (h *Hub) RegisterRemoteSKI(ski string, enable bool) {
// Disconnect a connection to an SKI, used by a service implementation
// e.g. if heartbeats go wrong
func (h *Hub) DisconnectSKI(ski string, reason string) {
h.muxCon.Lock()
defer h.muxCon.Unlock()

// The connection with the higher SKI should retain the connection
con, ok := h.connections[ski]
if !ok {
con := h.connectionForSKI(ski)
if con == nil {
return
}

Expand Down

0 comments on commit 0879c03

Please sign in to comment.