vendor: Update pfilter (ref #4561)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4572
This commit is contained in:
Audrius Butkevicius 2017-12-06 06:19:49 +00:00 committed by Jakob Borg
parent 257c3f5e82
commit 60bceb0f09
3 changed files with 24 additions and 9 deletions

View File

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

View File

@ -1,7 +1,6 @@
package pfilter
import (
"fmt"
"net"
"sync"
)
@ -13,14 +12,30 @@ var (
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

2
vendor/manifest vendored
View File

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