don't trip over truncated udp packets

and log such events, plus any other errors during decoding, nicely,
including the connection on which this occured.

Closes #123.
This commit is contained in:
Matthias Radestock committed 2014-10-15 21:03:15 +01:00
1 parent e8ec9e84ce
commit 4ddfc47448
4 files changed
+24 -4

No files matched your search

+4
View File
@@ -46,6 +46,10 @@ func (nce NameCollisionError) Error() string {
return fmt.Sprint("Multiple peers found with same name: ", nce.Name)
}
func (pde PacketDecodingError) Error() string {
return fmt.Sprint("Failed to decode packet: ", pde.Desc)
}
func (packet UDPPacket) String() string {
return fmt.Sprintf("UDP Packet\n name: %s\n sender: %v\n payload: % X", packet.Name, packet.Sender, packet.Packet)
}