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

+7
View File
@@ -287,3 +287,10 @@ func (c *Conn) RemotePub() *btcec.PublicKey {
func (c *Conn) LocalPub() *btcec.PublicKey {
return c.noise.localStatic.PubKey()
}
// ClearPendingSend drops references to the next header and body buffers and
// returns any pooled buffers back to their respective pools so that the memory
// can be reused.
func (c *Conn) ClearPendingSend() {
c.noise.releaseBuffers()
}