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
+4 -5
View File
@@ -48,6 +48,9 @@ type ConnConfig struct {
// Configure initializes the connection with the given buffer and queue configuration.
// Must be called before [Conn.Open]. Calling Configure on an active connection aborts it.
func (conn *Conn) Configure(cfg ConnConfig) error {
if cfg.RWBackoff == nil {
return lneto.ErrMissingHALConfig
}
conn.mu.Lock()
defer conn.mu.Unlock()
conn.abort()
@@ -302,11 +305,7 @@ func (conn *Conn) FreeInput() int {
}
func (conn *Conn) backoff(consecutiveBackoffs uint) {
if conn._backoff != nil {
conn._backoff.Do(consecutiveBackoffs)
} else {
internal.BackoffConnRW(consecutiveBackoffs)
}
conn._backoff.Do(consecutiveBackoffs)
}
func (conn *Conn) lockPipeConnID() (uint64, error) {