Skip to content

Commit 02940c3

Browse files
committed
Add SetOption to example
Signed-off-by: Florian Lehner <[email protected]>
1 parent 65ac230 commit 02940c3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

example_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"time"
1010

1111
nfqueue "github.com/florianl/go-nfqueue"
12+
"github.com/mdlayher/netlink"
1213
)
1314

1415
func ExampleNfqueue_RegisterWithErrorFunc() {
@@ -31,6 +32,13 @@ func ExampleNfqueue_RegisterWithErrorFunc() {
3132
}
3233
defer nf.Close()
3334

35+
// Avoid receiving ENOBUFS errors.
36+
if err := nf.SetOption(netlink.NoENOBUFS, true); err != nil {
37+
fmt.Printf("failed to set netlink option %v: %v\n",
38+
netlink.NoENOBUFS, err)
39+
return
40+
}
41+
3442
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
3543
defer cancel()
3644

0 commit comments

Comments
 (0)