From ec6e025284f97c37770ae39e5b679885d32ad185 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 25 Jan 2022 15:55:38 -0800 Subject: [PATCH] Version Fixups --- protocol/connections/peerapp.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/protocol/connections/peerapp.go b/protocol/connections/peerapp.go index bb9b9b0..bfc2c3e 100644 --- a/protocol/connections/peerapp.go +++ b/protocol/connections/peerapp.go @@ -48,7 +48,7 @@ func (pa *PeerApp) NewInstance() tapir.Application { newApp.OnAuth = pa.OnAuth newApp.OnClose = pa.OnClose newApp.OnConnecting = pa.OnConnecting - newApp.version.Store(0x01) + newApp.version.Store(Version1) return newApp } @@ -72,12 +72,13 @@ func (pa *PeerApp) Init(connection tapir.Connection) { // we are abusing the context here slightly by sending a "malformed" GetVal request. // as a rule cwtch ignores getval requests that it cannot deserialize so older clients will ignore this // message. - // version *must* be the first message sent to prevent race conditions for aut events fired on auth - // we send the message before we update the rest of the system + // version *must* be the first message sent to prevent race conditions for other events fired after-auth + // (e.g. getVal requests) + // as such, we send this message before we update the rest of the system pa.SendMessage(model2.PeerMessage{ ID: event.ContextVersion, Context: event.ContextGetVal, - Data: []byte{Version1}, + Data: []byte{Version2}, }) pa.OnAuth(connection.Hostname())