Skip to content
Snippets Groups Projects
Commit 22966a23 authored by Oliver Herms's avatar Oliver Herms
Browse files

Cleanup

parent 06210f4c
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@ func main() {
PeerAddress: net.IP([]byte{169, 254, 200, 1}),
LocalAddress: net.IP([]byte{169, 254, 200, 0}),
ReconnectInterval: time.Second * 15,
HoldTimer: time.Second * 90,
HoldTime: time.Second * 90,
KeepAlive: time.Second * 30,
Passive: true,
RouterID: b.RouterID(),
......@@ -56,7 +56,7 @@ func main() {
PeerAddress: net.IP([]byte{169, 254, 100, 0}),
LocalAddress: net.IP([]byte{169, 254, 100, 1}),
ReconnectInterval: time.Second * 15,
HoldTimer: time.Second * 90,
HoldTime: time.Second * 90,
KeepAlive: time.Second * 30,
Passive: true,
RouterID: b.RouterID(),
......
......@@ -57,7 +57,6 @@ type FSM2 struct {
capAddPathRecv bool
local net.IP
//remote net.IP
ribsInitialized bool
adjRIBIn routingtable.RouteTableClient
......
......@@ -106,7 +106,9 @@ func (s *openSentState) openMsgReceived(msg *packet.BGPMessage) (state, string)
openMsg := msg.Body.(*packet.BGPOpen)
s.fsm.neighborID = openMsg.BGPIdentifier
stopTimer(s.fsm.connectRetryTimer)
s.fsm.peer.collisionHandling(s.fsm)
if s.fsm.peer.collisionHandling(s.fsm) {
return s.cease()
}
err := s.fsm.sendKeepalive()
if err != nil {
return s.tcpFailure()
......
......@@ -4,6 +4,7 @@ import (
"fmt"
"io"
"net"
"strings"
"github.com/bio-routing/bio-rd/config"
"github.com/bio-routing/bio-rd/protocols/bgp/packet"
......@@ -60,10 +61,7 @@ func (b *BGPServer) Start(c *config.Global) error {
func (b *BGPServer) incomingConnectionWorker() {
for {
// Disabled. We're active only for now.
/*c := <-b.acceptCh
fmt.Printf("Incoming connection!\n")
fmt.Printf("Connection from: %v\n", c.RemoteAddr())
c := <-b.acceptCh
peerAddr := strings.Split(c.RemoteAddr().String(), ":")[0]
if _, ok := b.peers[peerAddr]; !ok {
......@@ -79,19 +77,16 @@ func (b *BGPServer) incomingConnectionWorker() {
}).Info("Incoming TCP connection")
log.WithField("Peer", peerAddr).Debug("Sending incoming TCP connection to fsm for peer")
fmt.Printf("Initiating new ActiveFSM due to incoming connection from peer %s\n", peerAddr)
fsm := NewActiveFSM2(b.peers[peerAddr])
fsm.state = newActiveState(fsm)
fsm.startConnectRetryTimer()
fmt.Printf("Getting lock...\n")
b.peers[peerAddr].fsmsMu.Lock()
b.peers[peerAddr].fsms = append(b.peers[peerAddr].fsms, fsm)
fmt.Printf("Releasing lock...\n")
b.peers[peerAddr].fsmsMu.Unlock()
go fsm.run()
fsm.conCh <- c*/
fsm.conCh <- c
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment