do not shut down connections on PacketDecodingError

This commit is contained in:
Matthias Radestock committed 2015-04-15 21:52:56 +01:00
1 parent f4ba0f7287
commit a5a91ebb33
2 files changed
+14 -13

No files matched your search

+12 -10
View File
@@ -250,16 +250,18 @@ func (router *Router) udpReader(conn *net.UDPConn, po PacketSink) {
if !ok {
continue
}
err = relayConn.Decryptor.IterateFrames(packet, router.handleUDPPacketFunc(dec, sender, po))
if pde, ok := err.(PacketDecodingError); ok {
if pde.Fatal {
relayConn.Shutdown(pde)
} else {
relayConn.Log(pde.Error())
}
continue
}
if err != nil {
if err := relayConn.Decryptor.IterateFrames(packet, router.handleUDPPacketFunc(dec, sender, po)); err != nil {
// Errors during UDP packet decoding / processing are
// non-fatal. One common cause is that we receive and
// attempt to decrypt a "stray" packet. This can actually
// happen quite easily if there is some connection churn
// between two peers. After all, UDP isn't a
// connection-oriented protocol, yet we pretend it is.
//
// If anything really is seriously, unrecoverably amiss
// with a connection, that will typically result in missed
// heartbeats and the connection getting shut down because
// of that.
relayConn.Log(err)
}
}