func (p *ProtocolHandler) SendMessage(toPeer peer.ID, msg proto.Message) error {
	logrus.WithFields(logrus.Fields{
		"peer":  toPeer,
		"msg":   proto.MessageName(msg),
		"proto": p.ID,
	}).Debug("sending message")
	p.outgoingMessagesLock.RLock()
	msgsChan, found := p.outgoingMessages[toPeer]
	p.outgoingMessagesLock.RUnlock()
	if !found {
		return fmt.Errorf("not tracking peer %s", toPeer)
	}

	msgsChan <- msg
	return nil
}
// SendMessage writes a message to a peer.
SendMessage writes a message to a peer.
// SendMessage writes a message to a peer .
func (p *ProtocolHandler) SendMessage(toPeer peer.ID, msg proto.Message) error {
	logrus.WithFields(logrus.Fields{
		"peer":  toPeer,
		"msg":   proto.MessageName(msg),
		"proto": p.ID,
	}).Debug("sending message")
	p.outgoingMessagesLock.RLock()
	msgsChan, found := p.outgoingMessages[toPeer]
	p.outgoingMessagesLock.RUnlock()
	if !found {
		return fmt.Errorf("not tracking peer %s", toPeer)
	}
	msgsChan <- msg
	return nil
}
func ( p * ProtocolHandler ) SendMessage ( toPeer peer . ID , msg proto . Message ) error { logrus . WithFields ( logrus . Fields { " " : toPeer , " " : proto . MessageName ( msg ) , " " : p . ID , } ) . Debug ( " " ) p . outgoingMessagesLock . RLock ( ) msgsChan , found := p . outgoingMessages [ toPeer ] p . outgoingMessagesLock . RUnlock ( ) if ! found { return fmt . Errorf ( " " , toPeer ) } msgsChan <- msg return nil }
SendMessage writes a message to a peer.
SendMessage writes a message to a peer .