diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-05-27 11:02:07 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-05-27 11:02:07 +0900 |
commit | 637b5f9ba663b739de54069d91b1d87ddd3b4855 (patch) | |
tree | 9471595dcb17489b4a4ad4b2562262b056370563 /server/server.go | |
parent | b00a45b094ffb70db90a4e67d8599e939ca6857e (diff) |
server: fix File() misuse for md5 setsockopt
Fixed TCPListener.File() misuse.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/server/server.go b/server/server.go index 47166602..930e1067 100644 --- a/server/server.go +++ b/server/server.go @@ -131,15 +131,14 @@ func (server *BgpServer) Serve() { os.Exit(1) } - listenFile := func(addr net.IP) *os.File { + listener := func(addr net.IP) *net.TCPListener { var l *net.TCPListener if addr.To4() != nil { l = listenerMap["tcp4"] } else { l = listenerMap["tcp6"] } - f, _ := l.File() - return f + return l } server.peerMap = make(map[string]peerMapInfo) @@ -157,8 +156,7 @@ func (server *BgpServer) Serve() { } case peer := <-server.addedPeerCh: addr := peer.NeighborAddress.String() - f := listenFile(peer.NeighborAddress) - SetTcpMD5SigSockopts(int(f.Fd()), addr, peer.AuthPassword) + SetTcpMD5SigSockopts(listener(peer.NeighborAddress), addr, peer.AuthPassword) sch := make(chan *serverMsg, 8) pch := make(chan *peerMsg, 4096) var l []*serverMsgDataPeer @@ -199,8 +197,7 @@ func (server *BgpServer) Serve() { } case peer := <-server.deletedPeerCh: addr := peer.NeighborAddress.String() - f := listenFile(peer.NeighborAddress) - SetTcpMD5SigSockopts(int(f.Fd()), addr, "") + SetTcpMD5SigSockopts(listener(peer.NeighborAddress), addr, "") info, found := server.peerMap[addr] if found { log.Info("Delete a peer configuration for ", addr) |