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

Cleanup

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