Flush fix (#85)
Clear messages after netlink return error Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
This commit is contained in:
parent
7a7d417622
commit
1f2240c488
7
conn.go
7
conn.go
|
@ -41,7 +41,10 @@ type Conn struct {
|
|||
// Flush sends all buffered commands in a single batch to nftables.
|
||||
func (cc *Conn) Flush() error {
|
||||
cc.Lock()
|
||||
defer cc.Unlock()
|
||||
defer func() {
|
||||
cc.messages = nil
|
||||
cc.Unlock()
|
||||
}()
|
||||
if len(cc.messages) == 0 {
|
||||
// Messages were already programmed, returning nil
|
||||
return nil
|
||||
|
@ -64,8 +67,6 @@ func (cc *Conn) Flush() error {
|
|||
return fmt.Errorf("Receive: %w", err)
|
||||
}
|
||||
|
||||
cc.messages = nil
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue