summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/server/server.go b/server/server.go
index b9d0ddf6..ebb7a611 100644
--- a/server/server.go
+++ b/server/server.go
@@ -26,7 +26,6 @@ import (
"os"
"sort"
"strconv"
- "strings"
)
type serverMsgType int
@@ -146,13 +145,7 @@ func (server *BgpServer) Serve() {
for {
select {
case conn := <-acceptCh:
- remoteAddr := func(addrPort string) string {
- if strings.Index(addrPort, "[") == -1 {
- return strings.Split(addrPort, ":")[0]
- }
- idx := strings.LastIndex(addrPort, ":")
- return addrPort[1 : idx-1]
- }(conn.RemoteAddr().String())
+ remoteAddr, _, _ := net.SplitHostPort(conn.RemoteAddr().String())
info, found := server.peerMap[remoteAddr]
if found {
log.Info("accepted a new passive connection from ", remoteAddr)