summaryrefslogtreecommitdiffhomepage
path: root/pkg/server/peer.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/server/peer.go')
-rw-r--r--pkg/server/peer.go33
1 files changed, 2 insertions, 31 deletions
diff --git a/pkg/server/peer.go b/pkg/server/peer.go
index b4a7b23c..d7fb46c3 100644
--- a/pkg/server/peer.go
+++ b/pkg/server/peer.go
@@ -24,7 +24,6 @@ import (
"github.com/osrg/gobgp/internal/pkg/table"
"github.com/osrg/gobgp/pkg/packet/bgp"
- "github.com/eapache/channels"
log "github.com/sirupsen/logrus"
)
@@ -97,7 +96,6 @@ type peer struct {
tableId string
fsm *fsm
adjRibIn *table.AdjRib
- outgoing *channels.InfiniteChannel
policy *table.RoutingPolicy
localRib *table.TableManager
prefixLimitWarned map[bgp.RouteFamily]bool
@@ -106,7 +104,6 @@ type peer struct {
func newPeer(g *config.Global, conf *config.Neighbor, loc *table.TableManager, policy *table.RoutingPolicy) *peer {
peer := &peer{
- outgoing: channels.NewInfiniteChannel(),
localRib: loc,
policy: policy,
fsm: newFSM(g, conf, policy),
@@ -528,8 +525,8 @@ func (peer *peer) handleUpdate(e *fsmMsg) ([]*table.Path, []bgp.RouteFamily, *bg
return nil, nil, nil
}
-func (peer *peer) startFSMHandler(incoming *channels.InfiniteChannel, stateCh chan *fsmMsg) {
- handler := newFSMHandler(peer.fsm, incoming, stateCh, peer.outgoing)
+func (peer *peer) startFSMHandler() {
+ handler := newFSMHandler(peer.fsm, peer.fsm.outgoingCh)
peer.fsm.lock.Lock()
peer.fsm.h = handler
peer.fsm.lock.Unlock()
@@ -554,29 +551,3 @@ func (peer *peer) PassConn(conn *net.TCPConn) {
func (peer *peer) DropAll(rfList []bgp.RouteFamily) {
peer.adjRibIn.Drop(rfList)
}
-
-func (peer *peer) stopFSM() error {
- failed := false
- peer.fsm.lock.RLock()
- addr := peer.fsm.pConf.State.NeighborAddress
- state := peer.fsm.state
- peer.fsm.lock.RUnlock()
- t1 := time.AfterFunc(time.Minute*5, func() {
- log.WithFields(log.Fields{
- "Topic": "Peer",
- }).Warnf("Failed to free the fsm.h.t for %s", addr)
- failed = true
- })
- peer.fsm.h.ctxCancel()
- peer.fsm.h.wg.Wait()
- t1.Stop()
- if !failed {
- log.WithFields(log.Fields{
- "Topic": "Peer",
- "Key": addr,
- "State": state,
- }).Debug("freed fsm.h.t")
- cleanInfiniteChannel(peer.outgoing)
- }
- return fmt.Errorf("failed to free FSM for %s", addr)
-}