discovery+peer: add logs to reveal shutdown flow

Also adds a `TODO` for checking the err chan.
This commit is contained in:
yyforyongyu 2022-11-21 01:18:23 +08:00
parent 8dceb739ff
commit 716c685f10
No known key found for this signature in database
GPG key ID: 9BCD95C4FF296868
5 changed files with 12 additions and 0 deletions

View file

@ -658,6 +658,7 @@ func (d *AuthenticatedGossiper) Stop() error {
func (d *AuthenticatedGossiper) stop() {
log.Info("Authenticated Gossiper is stopping")
defer log.Info("Authenticated Gossiper stopped")
d.blockEpochs.Cancel()

View file

@ -84,6 +84,9 @@ func (s *reliableSender) Start() error {
// Stop halts the reliable sender from sending messages to peers.
func (s *reliableSender) Stop() {
s.stop.Do(func() {
log.Debugf("reliableSender is stopping")
defer log.Debugf("reliableSender stopped")
close(s.quit)
s.wg.Wait()
})

View file

@ -183,6 +183,9 @@ func (m *SyncManager) Start() {
// Stop stops the SyncManager from performing its duties.
func (m *SyncManager) Stop() {
m.stop.Do(func() {
log.Debugf("SyncManager is stopping")
defer log.Debugf("SyncManager stopped")
close(m.quit)
m.wg.Wait()

View file

@ -450,6 +450,9 @@ func (g *GossipSyncer) Start() {
// exited.
func (g *GossipSyncer) Stop() {
g.stopped.Do(func() {
log.Debugf("Stopping GossipSyncer(%x)", g.cfg.peerPub[:])
defer log.Debugf("GossipSyncer(%x) stopped", g.cfg.peerPub[:])
close(g.quit)
g.wg.Wait()
})

View file

@ -1401,6 +1401,8 @@ func newChanMsgStream(p *Brontide, cid lnwire.ChannelID) *msgStream {
// channel announcements.
func newDiscMsgStream(p *Brontide) *msgStream {
apply := func(msg lnwire.Message) {
// TODO(yy): `ProcessRemoteAnnouncement` returns an error chan
// and we need to process it.
p.cfg.AuthGossiper.ProcessRemoteAnnouncement(msg, p)
}