From 06f58812c3a213f45694bea6d760ccf9cbb2f8ba Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Thu, 25 May 2023 11:03:00 +0200 Subject: [PATCH] wip --- lib/model/model.go | 7 +++---- lib/protocol/protocol.go | 8 +++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/model/model.go b/lib/model/model.go index 46b9a3cef..0456d5452 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -283,13 +283,13 @@ func (m *model) serve(ctx context.Context) error { for { select { case <-ctx.Done(): - l.Infoln("context closed, stopping", ctx.Err()) + l.Infoln(m, "context closed, stopping", ctx.Err()) return ctx.Err() case err := <-m.fatalChan: - l.Infoln("fatal error, stopping", err) + l.Infoln(m, "fatal error, stopping", err) return svcutil.AsFatalErr(err, svcutil.ExitError) case <-m.promotionTimer.C: - l.Infoln("promotion timer fired") + l.Infoln(m, "promotion timer fired") m.promoteConnections() } } @@ -1217,7 +1217,6 @@ func (m *model) ClusterConfig(conn protocol.Connection, cm protocol.ClusterConfi if cm.Secondary { // No handling of secondary connection ClusterConfigs; they merely // indicate the connection is ready to start. - l.Infoln("Ignoring secondary connection cluster-config on connection", conn.ConnectionID()) return nil } diff --git a/lib/protocol/protocol.go b/lib/protocol/protocol.go index 848d894d0..428ffeb9d 100644 --- a/lib/protocol/protocol.go +++ b/lib/protocol/protocol.go @@ -440,8 +440,6 @@ func (c *rawConnection) readerLoop() { } func (c *rawConnection) dispatcherLoop() (err error) { - l.Infof("dispatcher loop started: %v", err) - defer l.Infof("dispatcher loop stopped: %v", err) defer close(c.dispatcherLoopStopped) var msg message state := stateInitial @@ -963,7 +961,11 @@ func (c *rawConnection) internalClose(err error) { } c.awaitingMut.Unlock() - <-c.dispatcherLoopStopped + if !c.startTime.IsZero() { + // Wait for the dispatcher loop to exit, if it was started to + // begin with. + <-c.dispatcherLoopStopped + } c.model.Closed(err) })