go 1.5 broke PMTU detection
This commit is contained in:
1 parent
5860492a38
commit
5aa58e6043
1 file changed
+11
-6
+11
-6
@@ -6,6 +6,7 @@ import (
|
|||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/weaveworks/weave/common"
|
"github.com/weaveworks/weave/common"
|
||||||
)
|
)
|
||||||
@@ -26,15 +27,19 @@ func checkWarn(e error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Look inside an error produced by the net package to get to the
|
||||||
|
// syscall.Errno at the root of the problem.
|
||||||
func PosixError(err error) error {
|
func PosixError(err error) error {
|
||||||
if err == nil {
|
if operr, ok := err.(*net.OpError); ok {
|
||||||
return nil
|
err = operr.Err
|
||||||
}
|
}
|
||||||
operr, ok := err.(*net.OpError)
|
|
||||||
if !ok {
|
// go1.5 wraps an Errno inside a SyscallError inside an OpError
|
||||||
return nil
|
if scerr, ok := err.(*os.SyscallError); ok {
|
||||||
|
err = scerr.Err
|
||||||
}
|
}
|
||||||
return operr.Err
|
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mtbe MsgTooBigError) Error() string {
|
func (mtbe MsgTooBigError) Error() string {
|
||||||
|
|||||||
Reference in new issue
Block a user