diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-06-09 21:20:07 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-06-09 23:20:15 +0900 |
commit | ca832f94bbb1c8e0cecfd7118366a48159512e23 (patch) | |
tree | 7197e7bfb41d612be3549ddfa8bd2f3f2c71f2db /server/fsm_test.go | |
parent | a97129f1400f2be76942124f535fb9831063aa5a (diff) |
server: kill peerMsg
Peers send and receive messages via channels, which could lead to a
deadlock. With this patch, multiple goroutines are used for network
I/Os per peer but one goroutine handle all ribs (including the global
rib). So there is no messages via channels between peers.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/fsm_test.go')
-rw-r--r-- | server/fsm_test.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/server/fsm_test.go b/server/fsm_test.go index 8c40d81c..ef962598 100644 --- a/server/fsm_test.go +++ b/server/fsm_test.go @@ -289,19 +289,14 @@ func makePeerAndHandler() (*Peer, *FSMHandler) { p := &Peer{ globalConfig: globalConfig, - peerConfig: neighborConfig, - connCh: make(chan net.Conn), - serverMsgCh: make(chan *serverMsg), - peerMsgCh: make(chan *peerMsg), - getActiveCh: make(chan struct{}), + config: neighborConfig, capMap: make(map[bgp.BGPCapabilityCode]bgp.ParameterCapabilityInterface), } - p.siblings = make(map[string]*serverMsgDataPeer) - p.fsm = NewFSM(&globalConfig, &neighborConfig, p.connCh) + p.fsm = NewFSM(&globalConfig, &neighborConfig) - incoming := make(chan *fsmMsg, FSM_CHANNEL_LENGTH) - p.outgoing = make(chan *bgp.BGPMessage, FSM_CHANNEL_LENGTH) + incoming := make(chan *fsmMsg, 4096) + p.outgoing = make(chan *bgp.BGPMessage, 4096) h := &FSMHandler{ fsm: p.fsm, @@ -309,7 +304,6 @@ func makePeerAndHandler() (*Peer, *FSMHandler) { incoming: incoming, outgoing: p.outgoing, } - p.t.Go(p.connectLoop) return p, h |