lneto rework: Require explicit BackoffStrategy in all APIs (#116)

* make backoff explicit API

* fix tests to use explicit backoff

* fix examples with explicit tcp
This commit is contained in:
Pat Whittingslow
2026-06-09 10:20:40 -03:00
committed by GitHub
parent 3b82cefec3
commit 6ba06acdcb
28 changed files with 324 additions and 84 deletions
+7
View File
@@ -4,7 +4,9 @@ import (
"encoding/binary"
"net/netip"
"testing"
"time"
"github.com/soypat/lneto"
"github.com/soypat/lneto/internal"
)
@@ -26,6 +28,7 @@ func newTestConn(t *testing.T) *Conn {
TxBuf: make([]byte, 256),
RxQueueSize: 4,
TxQueueSize: 4,
RWBackoff: backoffYield,
})
if err != nil {
t.Fatal(err)
@@ -239,3 +242,7 @@ func TestConn_FrameOffset(t *testing.T) {
t.Fatalf("got %q, want %q", string(buf[:n]), "hi")
}
}
func backoffYield(backoffs uint) time.Duration {
return lneto.BackoffFlagGosched
}