mirror of
https://github.com/lightningnetwork/lnd.git
synced 2026-08-16 13:00:19 +02:00
This commit adds per-peer backpressure control to the onion message actor system by introducing a BackpressureMailbox that uses Random Early Detection (RED) to probabilistically drop messages when the per-peer queue depth exceeds a configurable threshold. The OnionActorFactory type now accepts variadic ActorOptions, allowing the spawn call site (brontide) to provide per-peer mailbox configuration. A DefaultOnionActorOpts helper provides the standard RED thresholds so callers don't need to wire up the BackpressureMailbox manually. Key changes: - OnionActorFactory signature extended with ...ActorOption[*Request, *Response] so backpressure policy is no longer baked into the factory. - NewOnionActorFactory drops its shouldDrop parameter; it forwards opts through to serviceKey.Spawn. - DefaultOnionActorOpts(shouldDrop) returns the default backpressure options (BackpressureMailbox + DefaultOnionMailboxSize). - peer.Config gains OnionActorOpts callback for per-peer customization. - server.go creates default opts once and returns them for every peer. |
||
|---|---|---|
| .. | ||
| actor.go | ||
| actor_test.go | ||
| errors.go | ||
| hop.go | ||
| hop_test.go | ||
| interfaces.go | ||
| log.go | ||
| onion_endpoint.go | ||
| resolver.go | ||
| resolver_test.go | ||
| test_utils.go | ||