Skip to content

Commit 8ceb7ef

Browse files
committed
Add SetOption to example
Signed-off-by: Florian Lehner <[email protected]>
1 parent 037c0e3 commit 8ceb7ef

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

example_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ func ExampleNfqueue_RegisterWithErrorFunc() {
3131
}
3232
defer nf.Close()
3333

34+
// Avoid receiving ENOBUFS errors.
35+
if err := nf.SetOption(netlink.NoENOBUFS, true); err != nil {
36+
fmt.Fprintf(os.Stderr, "failed to set netlink option %v: %v",
37+
netlink.NoENOBUFS, err)
38+
return
39+
}
40+
3441
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
3542
defer cancel()
3643

0 commit comments

Comments
 (0)