mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 13:41:37 +00:00
network: drop unused EnqueueMessage interface from Peer
This commit is contained in:
parent
b345581c72
commit
d5f2ad86a1
3 changed files with 4 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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{}))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue