server: remove unused SendToPeer method
This commit is contained in:
parent
0ae06c8189
commit
b50fd33915
47
server.go
47
server.go
@ -1926,53 +1926,6 @@ func (s *server) BroadcastMessage(skips map[routing.Vertex]struct{},
|
||||
return nil
|
||||
}
|
||||
|
||||
// SendToPeer send a message to the server telling it to send the specific set
|
||||
// of message to a particular peer. If the peer connect be found, then this
|
||||
// method will return a non-nil error.
|
||||
//
|
||||
// NOTE: This function is safe for concurrent access.
|
||||
func (s *server) SendToPeer(target *btcec.PublicKey,
|
||||
msgs ...lnwire.Message) error {
|
||||
|
||||
// Compute the target peer's identifier.
|
||||
targetPubBytes := target.SerializeCompressed()
|
||||
|
||||
srvrLog.Tracef("Attempting to send msgs %v to: %x",
|
||||
len(msgs), targetPubBytes)
|
||||
|
||||
// Lookup intended target in peersByPub, returning an error to the
|
||||
// caller if the peer is unknown. Access to peersByPub is synchronized
|
||||
// here to ensure we consider the exact set of peers present at the
|
||||
// time of invocation.
|
||||
s.mu.RLock()
|
||||
targetPeer, err := s.findPeerByPubStr(string(targetPubBytes))
|
||||
s.mu.RUnlock()
|
||||
if err == ErrPeerNotConnected {
|
||||
srvrLog.Errorf("unable to send message to %x, "+
|
||||
"peer is not connected", targetPubBytes)
|
||||
return err
|
||||
}
|
||||
|
||||
// Send messages to the peer and get the error channels that will be
|
||||
// signaled by the peer's write handler.
|
||||
errChans := s.sendPeerMessages(targetPeer, msgs, nil)
|
||||
|
||||
// With the server's shared lock released, we now handle all of the
|
||||
// errors being returned from the target peer's write handler.
|
||||
for _, errChan := range errChans {
|
||||
select {
|
||||
case err := <-errChan:
|
||||
return err
|
||||
case <-targetPeer.quit:
|
||||
return ErrPeerExiting
|
||||
case <-s.quit:
|
||||
return ErrServerShuttingDown
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NotifyWhenOnline can be called by other subsystems to get notified when a
|
||||
// particular peer comes online. The peer itself is sent across the peerChan.
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user