Move call to tell ConnectionMaker that connection is established onto the queryLoop goroutine to avoid races with shutdown events

This commit is contained in:
Bryan Boreham committed 2014-09-08 17:31:38 +01:00
1 parent 64999d830d
commit f8f32a60ba
1 file changed
+1 -1
+1 -1
View File
@@ -221,6 +221,7 @@ func (conn *LocalConnection) handleSetEstablished() error {
conn.established = true
conn.Unlock()
if !old {
conn.Router.ConnectionMaker.ConnectionEstablished(conn.remoteTCPAddr)
conn.local.ConnectionEstablished(conn)
if err := conn.ensureHeartbeat(false); err != nil {
return err
@@ -447,7 +448,6 @@ func (conn *LocalConnection) receiveTCP(decoder *gob.Decoder, usingPassword bool
// them and thus has informed us via TCP that it considers
// the connection is now up. We now do a fetchAll on it.
conn.SetEstablished()
conn.Router.ConnectionMaker.ConnectionEstablished(conn.remoteTCPAddr)
conn.SendTCP(ProtocolFetchAllByte)
} else if msg[0] == ProtocolStartFragmentationTest {
conn.Forward(false, &ForwardedFrame{