OSDN Git Service

Hulk did something
[bytom/vapor.git] / p2p / netutil / error.go
diff --git a/p2p/netutil/error.go b/p2p/netutil/error.go
new file mode 100644 (file)
index 0000000..c660833
--- /dev/null
@@ -0,0 +1,16 @@
+package netutil
+
+// isPacketTooBig reports whether err indicates that a UDP packet didn't
+// fit the receive buffer. There is no such error on
+// non-Windows platforms.
+func isPacketTooBig(err error) bool {
+       return false
+}
+
+// IsTemporaryError checks whether the given error should be considered temporary.
+func IsTemporaryError(err error) bool {
+       tempErr, ok := err.(interface {
+               Temporary() bool
+       })
+       return ok && tempErr.Temporary() || isPacketTooBig(err)
+}