mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +02:00
brontide: remove async goroutine to process gossip process result
We cannot rely on a response currently so we avoid spawning goroutines. This is just a temporary fix to avoid the goroutine leak.
This commit is contained in:
@@ -2000,32 +2000,22 @@ func newDiscMsgStream(p *Brontide) *msgStream {
|
|||||||
// so that a parent context can be passed in here.
|
// so that a parent context can be passed in here.
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
|
|
||||||
|
// Processing here means we send it to the gossiper which then
|
||||||
|
// decides whether this message is processed immediately or
|
||||||
|
// waits for dependent messages to be processed. It can also
|
||||||
|
// happen that the message is not processed at all if it is
|
||||||
|
// premature and the LRU cache fills up and the message is
|
||||||
|
// deleted.
|
||||||
p.log.Debugf("Processing remote msg %T", msg)
|
p.log.Debugf("Processing remote msg %T", msg)
|
||||||
|
|
||||||
errChan := p.cfg.AuthGossiper.ProcessRemoteAnnouncement(
|
// TODO(ziggie): ProcessRemoteAnnouncement returns an error
|
||||||
ctx, msg, p,
|
// channel, but we cannot rely on it being written to.
|
||||||
)
|
// Because some messages might never be processed (e.g.
|
||||||
|
// premature channel updates). We should change the design here
|
||||||
// Start a goroutine to process the error channel for logging
|
// and use the actor model pattern as soon as it is available.
|
||||||
// purposes.
|
// So for now we should NOT use the error channel.
|
||||||
//
|
// See https://github.com/lightningnetwork/lnd/pull/9820.
|
||||||
// TODO(ziggie): Maybe use the error to potentially punish the
|
p.cfg.AuthGossiper.ProcessRemoteAnnouncement(ctx, msg, p)
|
||||||
// peer depending on the error ?
|
|
||||||
go func() {
|
|
||||||
select {
|
|
||||||
case <-p.cg.Done():
|
|
||||||
return
|
|
||||||
|
|
||||||
case err := <-errChan:
|
|
||||||
if err != nil {
|
|
||||||
p.log.Warnf("Error processing remote "+
|
|
||||||
"msg %T: %v", msg,
|
|
||||||
err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p.log.Debugf("Processed remote msg %T", msg)
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return newMsgStream(
|
return newMsgStream(
|
||||||
|
Reference in New Issue
Block a user