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
@@ -62,6 +62,9 @@ type ConnConfig struct {
}
func (conn *Conn) Configure(config ConnConfig) (err error) {
if config.RWBackoff == nil {
return lneto.ErrMissingHALConfig
}
conn.mu.Lock()
defer conn.mu.Unlock()
err = conn.h.SetBuffers(config.TxBuf, config.RxBuf, config.TxPacketQueueSize)
@@ -483,9 +486,5 @@ func (conn *Conn) ConnectionID() *uint64 {
}
func (conn *Conn) backoff(consecutiveBackoffs uint) {
if conn._backoff != nil {
conn._backoff.Do(consecutiveBackoffs)
} else {
internal.BackoffConnRW(consecutiveBackoffs)
}
conn._backoff.Do(consecutiveBackoffs)
}