log unknown peer received in topology gossip
This commit is contained in:
1 parent
de45a85162
commit
65d0c8b4ce
4 files changed
+8
-6
No files matched your search
+3
-2
@@ -15,7 +15,8 @@ type Peers struct {
|
|||||||
onGC func(*Peer)
|
onGC func(*Peer)
|
||||||
}
|
}
|
||||||
|
|
||||||
type UnknownPeersError struct {
|
type UnknownPeerError struct {
|
||||||
|
Name PeerName
|
||||||
}
|
}
|
||||||
|
|
||||||
type NameCollisionError struct {
|
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
|
// Update refers to a peer which we have no knowledge
|
||||||
// of. Thus we can't apply the update. Abort.
|
// of. Thus we can't apply the update. Abort.
|
||||||
err = UnknownPeersError{}
|
err = UnknownPeerError{remoteName}
|
||||||
})
|
})
|
||||||
if decErr != nil && decErr != io.EOF {
|
if decErr != nil && decErr != io.EOF {
|
||||||
err = decErr
|
err = decErr
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
// TODO we should also test:
|
// TODO we should also test:
|
||||||
//
|
//
|
||||||
// - applying an incremental update, including the case where that
|
// - applying an incremental update, including the case where that
|
||||||
// leads to an UnknownPeersError
|
// leads to an UnknownPeerError
|
||||||
//
|
//
|
||||||
// - the "improved update" calculation
|
// - the "improved update" calculation
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-1
@@ -372,10 +372,11 @@ func (router *Router) Gossip() []byte {
|
|||||||
// or nil if nothing in the received message was new
|
// or nil if nothing in the received message was new
|
||||||
func (router *Router) OnGossip(buf []byte) ([]byte, error) {
|
func (router *Router) OnGossip(buf []byte) ([]byte, error) {
|
||||||
newUpdate, err := router.Peers.ApplyUpdate(buf)
|
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
|
// That update contained a peer we didn't know about; we
|
||||||
// ignore this; eventually we should receive an update
|
// ignore this; eventually we should receive an update
|
||||||
// containing a complete topology.
|
// containing a complete topology.
|
||||||
|
log.Println("topology gossip contained", err)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+2
-2
@@ -46,8 +46,8 @@ func (ftbe FrameTooBigError) Error() string {
|
|||||||
return fmt.Sprint("Frame too big error. Effective PMTU is ", ftbe.EPMTU)
|
return fmt.Sprint("Frame too big error. Effective PMTU is ", ftbe.EPMTU)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (upe UnknownPeersError) Error() string {
|
func (upe UnknownPeerError) Error() string {
|
||||||
return fmt.Sprint("Reference to unknown peers")
|
return fmt.Sprint("Reference to unknown peer ", upe.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nce NameCollisionError) Error() string {
|
func (nce NameCollisionError) Error() string {
|
||||||
|
|||||||
Reference in new issue
Block a user