This commit is contained in:
Jakob Borg 2023-05-25 11:03:00 +02:00
parent a5cbe9b48c
commit 06f58812c3
2 changed files with 8 additions and 7 deletions

View File

@ -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
}

View File

@ -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()
if !c.startTime.IsZero() {
// Wait for the dispatcher loop to exit, if it was started to
// begin with.
<-c.dispatcherLoopStopped
}
c.model.Closed(err)
})