mirror of
https://github.com/soypat/lneto.git
synced 2026-09-10 00:29:34 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user