Fetch an acknowledgement for each message that requested one
This fixes error handling when using lasting connections. fixes #170
This commit is contained in:
parent
2025aec0d2
commit
a346d51f53
8
conn.go
8
conn.go
|
@ -182,8 +182,14 @@ func (cc *Conn) Flush() error {
|
|||
return fmt.Errorf("SendMessages: %w", err)
|
||||
}
|
||||
|
||||
// Fetch the requested acknowledgement for each message we sent.
|
||||
for _, msg := range cc.messages {
|
||||
if msg.Header.Flags&netlink.Acknowledge == 0 {
|
||||
continue // message did not request an acknowledgement
|
||||
}
|
||||
if _, err := conn.Receive(); err != nil {
|
||||
return fmt.Errorf("Receive: %w", err)
|
||||
return fmt.Errorf("conn.Receive: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue