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:
3 files changed
+93
-6
No files matched your search
@@ -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() {
|
||||
|
||||
Reference in new issue
Block a user