Browse Source

vendor: Update pfilter (ref #4561)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4572
Audrius Butkevicius 8 years ago
parent
commit
60bceb0f09

+ 2 - 2
vendor/github.com/AudriusButkevicius/pfilter/conn.go

@@ -17,7 +17,7 @@ type FilteredConn struct {
 
 
 	filter Filter
 	filter Filter
 
 
-	closed   chan struct{}
+	closed chan struct{}
 }
 }
 
 
 // LocalAddr returns the local address
 // LocalAddr returns the local address
@@ -74,7 +74,7 @@ func (r *FilteredConn) ReadFrom(b []byte) (n int, addr net.Addr, err error) {
 
 
 	select {
 	select {
 	case <-timeout:
 	case <-timeout:
-		return 0, nil, &timeoutError{}
+		return 0, nil, errTimeout
 	case pkt := <-r.recvBuffer:
 	case pkt := <-r.recvBuffer:
 		copy(b[:pkt.n], pkt.buf)
 		copy(b[:pkt.n], pkt.buf)
 		bufPool.Put(pkt.buf[:maxPacketSize])
 		bufPool.Put(pkt.buf[:maxPacketSize])

+ 21 - 6
vendor/github.com/AudriusButkevicius/pfilter/misc.go

@@ -1,7 +1,6 @@
 package pfilter
 package pfilter
 
 
 import (
 import (
-	"fmt"
 	"net"
 	"net"
 	"sync"
 	"sync"
 )
 )
@@ -13,14 +12,30 @@ var (
 			return make([]byte, maxPacketSize)
 			return make([]byte, maxPacketSize)
 		},
 		},
 	}
 	}
-	errClosed = fmt.Errorf("use of closed network connection")
+	errTimeout = &netError{
+		msg:       "i/o timeout",
+		timeout:   true,
+		temporary: true,
+	}
+	errClosed = &netError{
+		msg:       "use of closed network connection",
+		timeout:   false,
+		temporary: false,
+	}
+
+	// Compile time interface assertion.
+	_ net.Error = (*netError)(nil)
 )
 )
 
 
-type timeoutError struct{}
+type netError struct {
+	msg       string
+	timeout   bool
+	temporary bool
+}
 
 
-func (e *timeoutError) Error() string   { return "i/o timeout" }
-func (e *timeoutError) Timeout() bool   { return true }
-func (e *timeoutError) Temporary() bool { return true }
+func (e *netError) Error() string   { return e.msg }
+func (e *netError) Timeout() bool   { return e.timeout }
+func (e *netError) Temporary() bool { return e.temporary }
 
 
 type filteredConnList []*FilteredConn
 type filteredConnList []*FilteredConn
 
 

+ 1 - 1
vendor/manifest

@@ -29,7 +29,7 @@
 			"importpath": "github.com/AudriusButkevicius/pfilter",
 			"importpath": "github.com/AudriusButkevicius/pfilter",
 			"repository": "https://github.com/AudriusButkevicius/pfilter",
 			"repository": "https://github.com/AudriusButkevicius/pfilter",
 			"vcs": "git",
 			"vcs": "git",
-			"revision": "56143fe9cebe95636de1275acf30fcca36a1383d",
+			"revision": "9dca34a5b530bfc9843fa8aa2ff08ff9821032cb",
 			"branch": "master",
 			"branch": "master",
 			"notests": true
 			"notests": true
 		},
 		},