From 0adc13ddfa5ce4620b29c0632b5b1bc9b72a2769 Mon Sep 17 00:00:00 2001 From: mappu Date: Thu, 9 Feb 2017 19:19:17 +1300 Subject: [PATCH] move our is-connected one half roundtrip sooner --- HubConnection.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/HubConnection.go b/HubConnection.go index ff9bc87..7d12d93 100644 --- a/HubConnection.go +++ b/HubConnection.go @@ -245,12 +245,7 @@ func (this *HubConnection) processProtocolMessage(message string) { } case "$UserIP": - // Final message in PtokaX connection handshake - trigger connection callback. - // This might not be the case for other hubsofts, though - if this.State != CONNECTIONSTATE_CONNECTED { - this.processEvent(HubEvent{EventType: EVENT_CONNECTION_STATE_CHANGED, StateChange: CONNECTIONSTATE_CONNECTED}) - this.State = CONNECTIONSTATE_CONNECTED - } + // TODO case "$ForceMove": this.Hco.Address = HubAddress(commandParts[1]) @@ -290,11 +285,18 @@ func (this *HubConnection) processProtocolMessage(message string) { if _, ok := this.supports["QuickList"]; ok { this.SayInfo() this.SayRaw("$GetNickList|") - this.sentOurHello = true } else { this.SayRaw("$ValidateNick " + Escape(this.Hco.Self.Nick) + "|") } + // This also counts as the end of the handshake from our POV. Consider + // ourselves logged in + this.sentOurHello = true + if this.State != CONNECTIONSTATE_CONNECTED { + this.processEvent(HubEvent{EventType: EVENT_CONNECTION_STATE_CHANGED, StateChange: CONNECTIONSTATE_CONNECTED}) + this.State = CONNECTIONSTATE_CONNECTED + } + } // IGNORABLE COMMANDS