tweak ProtocolSender API

make SendProtocolMsg return an error; this isn't used at any call
sites (yet) but is TRTTD.
This commit is contained in:
Matthias Radestock committed 2015-12-21 18:24:22 +00:00
1 parent b93ce1cea5
commit cb6176fd8a
3 files changed
+6 -6

No files matched your search

+3 -1
View File
@@ -121,10 +121,12 @@ func (conn *LocalConnection) Established() bool {
return conn.established return conn.established
} }
func (conn *LocalConnection) SendProtocolMsg(m ProtocolMsg) { func (conn *LocalConnection) SendProtocolMsg(m ProtocolMsg) error {
if err := conn.sendProtocolMsg(m); err != nil { if err := conn.sendProtocolMsg(m); err != nil {
conn.Shutdown(err) conn.Shutdown(err)
return err
} }
return nil
} }
// ACTOR methods // ACTOR methods
+2 -4
View File
@@ -24,11 +24,9 @@ func NewTestRouter(name string) *Router {
return router return router
} }
func (conn *mockGossipConnection) SendProtocolMsg(protocolMsg ProtocolMsg) { func (conn *mockGossipConnection) SendProtocolMsg(protocolMsg ProtocolMsg) error {
<-conn.start <-conn.start
if err := conn.dest.handleGossip(protocolMsg.tag, protocolMsg.msg); err != nil { return conn.dest.handleGossip(protocolMsg.tag, protocolMsg.msg)
panic(err)
}
} }
func (conn *mockGossipConnection) Start() { func (conn *mockGossipConnection) Start() {
+1 -1
View File
@@ -344,5 +344,5 @@ type ProtocolMsg struct {
} }
type ProtocolSender interface { type ProtocolSender interface {
SendProtocolMsg(m ProtocolMsg) SendProtocolMsg(m ProtocolMsg) error
} }