From cb6176fd8ac145d48eeaed2d9531587e53bac29a Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Mon, 21 Dec 2015 18:24:22 +0000 Subject: [PATCH] tweak ProtocolSender API make SendProtocolMsg return an error; this isn't used at any call sites (yet) but is TRTTD. --- mesh/connection.go | 4 +++- mesh/gossip_test.go | 6 ++---- mesh/protocol.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mesh/connection.go b/mesh/connection.go index ae03017d..1f90fb73 100644 --- a/mesh/connection.go +++ b/mesh/connection.go @@ -121,10 +121,12 @@ func (conn *LocalConnection) Established() bool { return conn.established } -func (conn *LocalConnection) SendProtocolMsg(m ProtocolMsg) { +func (conn *LocalConnection) SendProtocolMsg(m ProtocolMsg) error { if err := conn.sendProtocolMsg(m); err != nil { conn.Shutdown(err) + return err } + return nil } // ACTOR methods diff --git a/mesh/gossip_test.go b/mesh/gossip_test.go index d5e15afc..119961a8 100644 --- a/mesh/gossip_test.go +++ b/mesh/gossip_test.go @@ -24,11 +24,9 @@ func NewTestRouter(name string) *Router { return router } -func (conn *mockGossipConnection) SendProtocolMsg(protocolMsg ProtocolMsg) { +func (conn *mockGossipConnection) SendProtocolMsg(protocolMsg ProtocolMsg) error { <-conn.start - if err := conn.dest.handleGossip(protocolMsg.tag, protocolMsg.msg); err != nil { - panic(err) - } + return conn.dest.handleGossip(protocolMsg.tag, protocolMsg.msg) } func (conn *mockGossipConnection) Start() { diff --git a/mesh/protocol.go b/mesh/protocol.go index 7ac06050..eeac7ef8 100644 --- a/mesh/protocol.go +++ b/mesh/protocol.go @@ -344,5 +344,5 @@ type ProtocolMsg struct { } type ProtocolSender interface { - SendProtocolMsg(m ProtocolMsg) + SendProtocolMsg(m ProtocolMsg) error }