summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/sockopt_linux.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/sockopt_linux.go b/server/sockopt_linux.go
index 3c347581..146f87b6 100644
--- a/server/sockopt_linux.go
+++ b/server/sockopt_linux.go
@@ -212,8 +212,11 @@ func (d *TCPDialer) DialTCP(addr string, port int) (*net.TCPConn, error) {
fi := os.NewFile(uintptr(fd), "")
defer fi.Close()
- conn, err := net.FileConn(fi)
- return conn.(*net.TCPConn), err
+ if conn, err := net.FileConn(fi); err != nil {
+ return nil, err
+ } else {
+ return conn.(*net.TCPConn), err
+ }
}
err = syscall.Connect(fd, ra)