Skip to content

Commit

Permalink
update handshakeData mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
noot committed May 4, 2021
1 parent 7015fdd commit fd768e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dot/network/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ type handshakeData struct {
validated bool
handshake Handshake
stream libp2pnetwork.Stream
mu *sync.Mutex
*sync.Mutex
}

func newHandshakeData(received, validated bool, stream libp2pnetwork.Stream) handshakeData {
return handshakeData{
received: received,
validated: validated,
stream: stream,
mu: new(sync.Mutex),
Mutex: new(sync.Mutex),
}
}

Expand Down Expand Up @@ -215,8 +215,8 @@ func (s *Service) sendData(peer peer.ID, hs Handshake, info *notificationsProtoc
hsData = newHandshakeData(false, false, nil)
}

hsData.mu.Lock()
defer hsData.mu.Unlock()
hsData.Lock()
defer hsData.Unlock()

logger.Trace("sending outbound handshake", "protocol", info.protocolID, "peer", peer, "message", hs)
stream, err := s.host.send(peer, info.protocolID, hs)
Expand Down

0 comments on commit fd768e9

Please sign in to comment.