brontide+peer: use internal sync/pool to reduce allocations

This ensures that under medium to high load, we eliminate all
allocations once we arrive a steady state, re working memory.
This commit is contained in:
Olaoluwa Osuntokun committed 2025-09-24 11:52:01 -07:00
1 parent f968206849
commit 4c737d3f02
3 files changed
+93 -6

No files matched your search

+8
View File
@@ -19,6 +19,7 @@ import (
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btclog/v2"
"github.com/lightningnetwork/lnd/brontide"
"github.com/lightningnetwork/lnd/buffer"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
@@ -2705,6 +2706,13 @@ out:
goto retry
}
// Message has either been successfully sent or an
// unrecoverable error occurred. Either way, we can
// free the memory used to store the message.
if bConn, ok := p.cfg.Conn.(*brontide.Conn); ok {
bConn.ClearPendingSend()
}
// The write succeeded, reset the idle timer to prevent
// us from disconnecting the peer.
if !idleTimer.Stop() {