From b50fd339152398bda1b9a5e4af0d5fbcafc2454a Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Tue, 5 Mar 2019 17:09:01 -0800 Subject: [PATCH] server: remove unused SendToPeer method --- server.go | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/server.go b/server.go index 89f3ce18a..5bf1a22f3 100644 --- a/server.go +++ b/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. //