diff options
Diffstat (limited to 'pkg/server/fsm.go')
-rw-r--r-- | pkg/server/fsm.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pkg/server/fsm.go b/pkg/server/fsm.go index 2228b7ca..d7521f4e 100644 --- a/pkg/server/fsm.go +++ b/pkg/server/fsm.go @@ -179,8 +179,8 @@ type fsm struct { outgoingCh *channels.InfiniteChannel incomingCh *channels.InfiniteChannel reason *fsmStateReason - conn net.Conn - connCh chan net.Conn + conn Conn + connCh chan Conn idleHoldTime float64 opensentHoldTime float64 adminState adminState @@ -274,7 +274,7 @@ func newFSM(gConf *config.Global, pConf *config.Neighbor) *fsm { state: bgp.BGP_FSM_IDLE, outgoingCh: channels.NewInfiniteChannel(), incomingCh: channels.NewInfiniteChannel(), - connCh: make(chan net.Conn, 1), + connCh: make(chan Conn, 1), opensentHoldTime: float64(holdtimeOpensent), adminState: adminState, adminStateCh: make(chan adminStateOperation, 1), @@ -548,13 +548,13 @@ func (h *fsmHandler) connectLoop(ctx context.Context, wg *sync.WaitGroup) { } if err == nil { - d := net.Dialer{ + d := transport.NewDialer(&net.Dialer{ LocalAddr: laddr, Timeout: time.Duration(tick-1) * time.Second, Control: func(network, address string, c syscall.RawConn) error { return dialerControl(network, address, c, ttl, ttlMin, password, bindInterface) }, - } + }) conn, err := d.DialContext(ctx, "tcp", net.JoinHostPort(addr, strconv.Itoa(port))) select { @@ -638,7 +638,7 @@ func (h *fsmHandler) active(ctx context.Context) (bgp.FSMState, *fsmStateReason) ttl = int(fsm.pConf.Transport.Config.Ttl) } if ttl != 0 { - if err := setTCPTTLSockopt(conn.(*net.TCPConn), ttl); err != nil { + if err := conn.SetTCPTTLSockopt(ttl); err != nil { log.WithFields(log.Fields{ "Topic": "Peer", "Key": fsm.pConf.Config.NeighborAddress, @@ -647,7 +647,7 @@ func (h *fsmHandler) active(ctx context.Context) (bgp.FSMState, *fsmStateReason) } } if ttlMin != 0 { - if err := setTCPMinTTLSockopt(conn.(*net.TCPConn), ttlMin); err != nil { + if err := conn.SetTCPMinTTLSockopt(ttlMin); err != nil { log.WithFields(log.Fields{ "Topic": "Peer", "Key": fsm.pConf.Config.NeighborAddress, |