log unknown peer received in topology gossip

This commit is contained in:
Matthias Radestock committed 2015-01-31 11:31:45 +00:00
1 parent de45a85162
commit 65d0c8b4ce
4 files changed
+8 -6

No files matched your search

+3 -2
View File
@@ -15,7 +15,8 @@ type Peers struct {
onGC func(*Peer)
}
type UnknownPeersError struct {
type UnknownPeerError struct {
Name PeerName
}
type NameCollisionError struct {
@@ -208,7 +209,7 @@ func (peers *Peers) decodeUpdate(update []byte) (newPeers map[PeerName]*Peer, de
}
// Update refers to a peer which we have no knowledge
// of. Thus we can't apply the update. Abort.
err = UnknownPeersError{}
err = UnknownPeerError{remoteName}
})
if decErr != nil && decErr != io.EOF {
err = decErr
+1 -1
View File
@@ -10,7 +10,7 @@ import (
// TODO we should also test:
//
// - applying an incremental update, including the case where that
// leads to an UnknownPeersError
// leads to an UnknownPeerError
//
// - the "improved update" calculation
//
+2 -1
View File
@@ -372,10 +372,11 @@ func (router *Router) Gossip() []byte {
// or nil if nothing in the received message was new
func (router *Router) OnGossip(buf []byte) ([]byte, error) {
newUpdate, err := router.Peers.ApplyUpdate(buf)
if _, ok := err.(UnknownPeersError); err != nil && ok {
if _, ok := err.(UnknownPeerError); err != nil && ok {
// That update contained a peer we didn't know about; we
// ignore this; eventually we should receive an update
// containing a complete topology.
log.Println("topology gossip contained", err)
return nil, nil
}
if err != nil {
+2 -2
View File
@@ -46,8 +46,8 @@ func (ftbe FrameTooBigError) Error() string {
return fmt.Sprint("Frame too big error. Effective PMTU is ", ftbe.EPMTU)
}
func (upe UnknownPeersError) Error() string {
return fmt.Sprint("Reference to unknown peers")
func (upe UnknownPeerError) Error() string {
return fmt.Sprint("Reference to unknown peer ", upe.Name)
}
func (nce NameCollisionError) Error() string {