diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-07-30 14:44:16 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-07-30 14:44:16 +0900 |
commit | 122f08c1c511656723dd8b1a570264b9da3bf23b (patch) | |
tree | 653267dca819363cd62e0a4c0d8a3b68afcd7981 | |
parent | e117ae78ce8761b77b3d234b18464d0b0e1e35fe (diff) |
server: fix active connection error check
https://github.com/osrg/gobgp/issues/1391
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | server/sockopt_linux.go | 7 |
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) |