fix qlogging of version mismatches on the connection_closed event

This commit is contained in:
Marten Seemann
2021-03-15 13:31:39 +08:00
parent 5208845191
commit d468a79339
2 changed files with 15 additions and 1 deletions

View File

@@ -96,7 +96,6 @@ func (e eventConnectionClosed) Name() string { return "connection_closed"
func (e eventConnectionClosed) IsNil() bool { return false }
func (e eventConnectionClosed) MarshalJSONObject(enc *gojay.Encoder) {
// TODO: add version mismatch
if token, ok := e.Reason.StatelessReset(); ok {
enc.StringKey("owner", ownerRemote.String())
enc.StringKey("trigger", "stateless_reset")
@@ -124,6 +123,10 @@ func (e eventConnectionClosed) MarshalJSONObject(enc *gojay.Encoder) {
enc.StringKey("owner", owner.String())
enc.StringKey("connection_code", transportError(code).String())
}
if _, ok := e.Reason.VersionNegotiation(); ok {
enc.StringKey("owner", ownerRemote.String())
enc.StringKey("trigger", "version_negotiation")
}
}
type eventPacketSent struct {