From d5f2ad86a1ea112854a4dcd25eedfa29634a40a2 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 12 Oct 2022 15:27:08 +0300 Subject: [PATCH] network: drop unused EnqueueMessage interface from Peer --- pkg/network/peer.go | 4 ---- pkg/network/tcp_peer.go | 6 ------ pkg/network/tcp_peer_test.go | 8 ++++---- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/pkg/network/peer.go b/pkg/network/peer.go index 45ff68c98..78820ab56 100644 --- a/pkg/network/peer.go +++ b/pkg/network/peer.go @@ -20,10 +20,6 @@ type Peer interface { PeerAddr() net.Addr Disconnect(error) - // EnqueueMessage is a blocking packet enqueuer similar to EnqueueP2PMessage, - // but using the lowest priority queue. - EnqueueMessage(*Message) error - // BroadcastPacket is a context-bound packet enqueuer, it either puts the // given packet into the queue or exits with errors if the context expires // or peer disconnects. It accepts a slice of bytes that diff --git a/pkg/network/tcp_peer.go b/pkg/network/tcp_peer.go index c1a241947..3019d6780 100644 --- a/pkg/network/tcp_peer.go +++ b/pkg/network/tcp_peer.go @@ -132,12 +132,6 @@ func (p *TCPPeer) putMsgIntoQueue(queue chan<- []byte, msg *Message) error { return p.putPacketIntoQueue(queue, b) } -// EnqueueMessage is a temporary wrapper that sends a message via -// EnqueuePacket if there is no error in serializing it. -func (p *TCPPeer) EnqueueMessage(msg *Message) error { - return p.putMsgIntoQueue(p.sendQ, msg) -} - // EnqueueP2PPacket implements the Peer interface. func (p *TCPPeer) EnqueueP2PPacket(msg []byte) error { return p.putPacketIntoQueue(p.p2pSendQ, msg) diff --git a/pkg/network/tcp_peer_test.go b/pkg/network/tcp_peer_test.go index b1cdfa985..a4e2e8655 100644 --- a/pkg/network/tcp_peer_test.go +++ b/pkg/network/tcp_peer_test.go @@ -30,8 +30,8 @@ func TestPeerHandshake(t *testing.T) { require.Equal(t, false, tcpC.Handshaked()) // No ordinary messages can be written. - require.Error(t, tcpS.EnqueueMessage(&Message{})) - require.Error(t, tcpC.EnqueueMessage(&Message{})) + require.Error(t, tcpS.EnqueueP2PMessage(&Message{})) + require.Error(t, tcpC.EnqueueP2PMessage(&Message{})) // Try to mess with VersionAck on both client and server, it should fail. require.Error(t, tcpS.SendVersionAck(&Message{})) @@ -80,6 +80,6 @@ func TestPeerHandshake(t *testing.T) { require.Error(t, tcpS.SendVersionAck(&Message{})) // Now regular messaging can proceed. - require.NoError(t, tcpS.EnqueueMessage(&Message{})) - require.NoError(t, tcpC.EnqueueMessage(&Message{})) + require.NoError(t, tcpS.EnqueueP2PMessage(&Message{})) + require.NoError(t, tcpC.EnqueueP2PMessage(&Message{})) }