Skip to content

Commit

Permalink
incusd/network/ovsdb: Properly close the connections
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Dec 21, 2023
1 parent 2fbdbe9 commit 697cafa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/server/network/ovn/ovn_nb.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func NewNB(s *state.State) (*NB, error) {
// Set finalizer to stop the monitor.
runtime.SetFinalizer(client, func(o *NB) {
_ = ovn.MonitorCancel(context.Background(), o.cookie)
ovn.Close()
})

return client, nil
Expand Down
1 change: 1 addition & 0 deletions internal/server/network/ovn/ovn_sb.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ func NewSB(s *state.State) (*SB, error) {
// Set finalizer to stop the monitor.
runtime.SetFinalizer(client, func(o *SB) {
_ = ovn.MonitorCancel(context.Background(), o.cookie)
ovn.Close()
})

return client, nil
Expand Down
1 change: 1 addition & 0 deletions internal/server/network/ovs/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func NewVSwitch() (*VSwitch, error) {
// Set finalizer to stop the monitor.
runtime.SetFinalizer(client, func(o *VSwitch) {
_ = ovs.MonitorCancel(context.Background(), o.cookie)
ovs.Close()
})

// Get the root UUID.
Expand Down

0 comments on commit 697cafa

Please sign in to comment.