From f8f32a60ba9fbd6a786a0ff5e47a169485170424 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 8 Sep 2014 17:31:38 +0100 Subject: [PATCH] Move call to tell ConnectionMaker that connection is established onto the queryLoop goroutine to avoid races with shutdown events --- connection.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connection.go b/connection.go index 0b8a289f..eba52584 100644 --- a/connection.go +++ b/connection.go @@ -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{