diff --git a/p2p/base_reactor.go b/p2p/base_reactor.go index 266880536..daabab316 100644 --- a/p2p/base_reactor.go +++ b/p2p/base_reactor.go @@ -47,7 +47,9 @@ type Reactor interface { // // Only one of Receive or ReceiveEnvelope are called per message. If ReceiveEnvelope // is implemented, it will be used, otherwise the switch will fallback to - // using Receive. Receive will be replaced by ReceiveEnvelope in a future version + // using Receive. + // Deprecated: Reactors looking to receive data from a peer should implement ReceiveEnvelope. + // Receive will be deprecated in favor of ReceiveEnvelope in v0.38. Receive(chID byte, peer Peer, msgBytes []byte) } @@ -81,6 +83,6 @@ func (br *BaseReactor) SetSwitch(sw *Switch) { func (*BaseReactor) GetChannels() []*conn.ChannelDescriptor { return nil } func (*BaseReactor) AddPeer(peer Peer) {} func (*BaseReactor) RemovePeer(peer Peer, reason interface{}) {} -func (*BaseReactor) ReceiveEnvelope(e Envelope) {} +func (*BaseReactor) ReceiveEnvelope(e Envelope) {} func (*BaseReactor) Receive(chID byte, peer Peer, msgBytes []byte) {} func (*BaseReactor) InitPeer(peer Peer) Peer { return peer } diff --git a/p2p/peer.go b/p2p/peer.go index 55a6edf64..1ab75f92c 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -40,7 +40,12 @@ type Peer interface { SendEnvelope(Envelope) bool TrySendEnvelope(Envelope) bool + // Deprecated: entities looking to act as peers should implement SendEnvelope instead. + // Send will be removed in v0.38. Send(byte, []byte) bool + + // Deprecated: entities looking to act as peers should implement TrySendEnvelope instead. + // TrySend will be removed in v0.38. TrySend(byte, []byte) bool Set(string, interface{}) diff --git a/p2p/switch.go b/p2p/switch.go index 27b235868..cf2cb8eb0 100644 --- a/p2p/switch.go +++ b/p2p/switch.go @@ -300,6 +300,9 @@ func (sw *Switch) BroadcastEnvelope(e Envelope) chan bool { // Broadcasts sends to the peers using the Send method. // // NOTE: Broadcast uses goroutines, so order of broadcast may not be preserved. +// +// Deprecated: code looking to broadcast data to all peers should use BroadcastEnvelope. +// Broadcast will be removed in 0.38. func (sw *Switch) Broadcast(chID byte, msgBytes []byte) chan bool { sw.Logger.Debug("Broadcast", "channel", chID)