Version Fixups
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Sarah Jamie Lewis 2022-01-25 15:55:38 -08:00
parent a088e588b1
commit ec6e025284
1 changed files with 5 additions and 4 deletions

View File

@ -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())