discovery+peer: add logs to reveal shutdown flow

Also adds a `TODO` for checking the err chan.
This commit is contained in:
yyforyongyu committed 2022-12-08 17:57:01 +08:00
1 parent 8dceb739ff
commit 716c685f10
5 files changed
+12

No files matched your search

+1
View File
@@ -658,6 +658,7 @@ func (d *AuthenticatedGossiper) Stop() error {
func (d *AuthenticatedGossiper) stop() { func (d *AuthenticatedGossiper) stop() {
log.Info("Authenticated Gossiper is stopping") log.Info("Authenticated Gossiper is stopping")
defer log.Info("Authenticated Gossiper stopped")
d.blockEpochs.Cancel() d.blockEpochs.Cancel()
+3
View File
@@ -84,6 +84,9 @@ func (s *reliableSender) Start() error {
// Stop halts the reliable sender from sending messages to peers. // Stop halts the reliable sender from sending messages to peers.
func (s *reliableSender) Stop() { func (s *reliableSender) Stop() {
s.stop.Do(func() { s.stop.Do(func() {
log.Debugf("reliableSender is stopping")
defer log.Debugf("reliableSender stopped")
close(s.quit) close(s.quit)
s.wg.Wait() s.wg.Wait()
}) })
+3
View File
@@ -183,6 +183,9 @@ func (m *SyncManager) Start() {
// Stop stops the SyncManager from performing its duties. // Stop stops the SyncManager from performing its duties.
func (m *SyncManager) Stop() { func (m *SyncManager) Stop() {
m.stop.Do(func() { m.stop.Do(func() {
log.Debugf("SyncManager is stopping")
defer log.Debugf("SyncManager stopped")
close(m.quit) close(m.quit)
m.wg.Wait() m.wg.Wait()
+3
View File
@@ -450,6 +450,9 @@ func (g *GossipSyncer) Start() {
// exited. // exited.
func (g *GossipSyncer) Stop() { func (g *GossipSyncer) Stop() {
g.stopped.Do(func() { g.stopped.Do(func() {
log.Debugf("Stopping GossipSyncer(%x)", g.cfg.peerPub[:])
defer log.Debugf("GossipSyncer(%x) stopped", g.cfg.peerPub[:])
close(g.quit) close(g.quit)
g.wg.Wait() g.wg.Wait()
}) })
+2
View File
@@ -1401,6 +1401,8 @@ func newChanMsgStream(p *Brontide, cid lnwire.ChannelID) *msgStream {
// channel announcements. // channel announcements.
func newDiscMsgStream(p *Brontide) *msgStream { func newDiscMsgStream(p *Brontide) *msgStream {
apply := func(msg lnwire.Message) { apply := func(msg lnwire.Message) {
// TODO(yy): `ProcessRemoteAnnouncement` returns an error chan
// and we need to process it.
p.cfg.AuthGossiper.ProcessRemoteAnnouncement(msg, p) p.cfg.AuthGossiper.ProcessRemoteAnnouncement(msg, p)
} }