mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-22 14:51:45 +02:00
peer: always defer clean up of the block epoch client used for ping headers
In this commit, we fix an inadvertent memory leak by ensuring we always use `defer` to clean up the allocated objects/memory we use to be notified of new blocks to update what we send within the set of ping headers. A further optimization here would be using a single global block epoch housed within the server, that all peer `pingHandler` goroutines use directly. Fixes #6143.
This commit is contained in:
parent
ed511bb37f
commit
ae16f2b631
@ -2044,6 +2044,7 @@ func (p *Brontide) pingHandler() {
|
|||||||
"subscription: %v", err)
|
"subscription: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
defer blockEpochs.Cancel()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pingPayload [wire.MaxBlockHeaderPayload]byte
|
pingPayload [wire.MaxBlockHeaderPayload]byte
|
||||||
|
Loading…
x
Reference in New Issue
Block a user