Skip to content

Commit

Permalink
Add SetOption to example
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Lehner <[email protected]>
  • Loading branch information
florianl committed Apr 27, 2024
1 parent 037c0e3 commit 1323361
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

nfqueue "github.com/florianl/go-nfqueue"
"github.com/mdlayher/netlink"
)

func ExampleNfqueue_RegisterWithErrorFunc() {
Expand All @@ -31,6 +32,13 @@ func ExampleNfqueue_RegisterWithErrorFunc() {
}
defer nf.Close()

// Avoid receiving ENOBUFS errors.
if err := nf.SetOption(netlink.NoENOBUFS, true); err != nil {
fmt.Printf("failed to set netlink option %v: %v\n",
netlink.NoENOBUFS, err)
return
}

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

Expand Down

0 comments on commit 1323361

Please sign in to comment.