forked from TrueCloudLab/neoneo-go
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
|
PeerAddr() net.Addr
|
||||||
Disconnect(error)
|
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
|
// BroadcastPacket is a context-bound packet enqueuer, it either puts the
|
||||||
// given packet into the queue or exits with errors if the context expires
|
// given packet into the queue or exits with errors if the context expires
|
||||||
// or peer disconnects. It accepts a slice of bytes that
|
// 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)
|
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.
|
// EnqueueP2PPacket implements the Peer interface.
|
||||||
func (p *TCPPeer) EnqueueP2PPacket(msg []byte) error {
|
func (p *TCPPeer) EnqueueP2PPacket(msg []byte) error {
|
||||||
return p.putPacketIntoQueue(p.p2pSendQ, msg)
|
return p.putPacketIntoQueue(p.p2pSendQ, msg)
|
||||||
|
|
|
@ -30,8 +30,8 @@ func TestPeerHandshake(t *testing.T) {
|
||||||
require.Equal(t, false, tcpC.Handshaked())
|
require.Equal(t, false, tcpC.Handshaked())
|
||||||
|
|
||||||
// No ordinary messages can be written.
|
// No ordinary messages can be written.
|
||||||
require.Error(t, tcpS.EnqueueMessage(&Message{}))
|
require.Error(t, tcpS.EnqueueP2PMessage(&Message{}))
|
||||||
require.Error(t, tcpC.EnqueueMessage(&Message{}))
|
require.Error(t, tcpC.EnqueueP2PMessage(&Message{}))
|
||||||
|
|
||||||
// Try to mess with VersionAck on both client and server, it should fail.
|
// Try to mess with VersionAck on both client and server, it should fail.
|
||||||
require.Error(t, tcpS.SendVersionAck(&Message{}))
|
require.Error(t, tcpS.SendVersionAck(&Message{}))
|
||||||
|
@ -80,6 +80,6 @@ func TestPeerHandshake(t *testing.T) {
|
||||||
require.Error(t, tcpS.SendVersionAck(&Message{}))
|
require.Error(t, tcpS.SendVersionAck(&Message{}))
|
||||||
|
|
||||||
// Now regular messaging can proceed.
|
// Now regular messaging can proceed.
|
||||||
require.NoError(t, tcpS.EnqueueMessage(&Message{}))
|
require.NoError(t, tcpS.EnqueueP2PMessage(&Message{}))
|
||||||
require.NoError(t, tcpC.EnqueueMessage(&Message{}))
|
require.NoError(t, tcpC.EnqueueP2PMessage(&Message{}))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue