Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/images/Dockerfile.build.ubuntu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM registry.smtx.io/sdn-base/ubuntu:20.04

# Install golang

Expand Down
7 changes: 7 additions & 0 deletions ofctrl/ofctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ type AppInterface interface {
type Option func(opt *options)

type Controller struct {
sw *OFSwitch
app AppInterface
listener *net.TCPListener
wg sync.WaitGroup
Expand Down Expand Up @@ -188,6 +189,11 @@ func (c *Controller) Connect(sock string) {
continue
}
case <-c.exitCtx.Done():
c.wg.Wait()
if c.sw != nil {
c.sw.Disconnect()
log.Println("switch disconnected")
}
log.Println("Controller is delete")
return
}
Expand Down Expand Up @@ -315,6 +321,7 @@ func (c *Controller) handleConnection(conn net.Conn) {
reConnChan = c.connCh
}
s := NewSwitch(c.exitCtx, stream, m.DPID, c.app, reConnChan, c.controllerID, c.optionConfig.disableCleanGroup)
c.sw = s
if err := s.switchConnected(); err != nil {
log.Errorf("Failed to initialize OpenFlow switch %s: %v", m.DPID, err)
// Do not send event "ReConnection" in "switchDisconnected", because the event is sent in
Expand Down