From bd1ce11306527514218acbe0d12f7bcc23114239 Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Thu, 26 May 2022 18:19:24 -0700 Subject: Fix multiple issues with v1.8+ login sequence Squashed bugs: * A v1.8+ user that has connected but not agreed will show up in chat and the userlist as a blank user name * Race condition where a v1.8+ user in connected but not agreed state duplicated the ID of the next user to connect * A v1.8+ user that is connected but not agreed will receive the user list --- hotline/transaction_handlers_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'hotline/transaction_handlers_test.go') diff --git a/hotline/transaction_handlers_test.go b/hotline/transaction_handlers_test.go index 56968a1..7c5ee43 100644 --- a/hotline/transaction_handlers_test.go +++ b/hotline/transaction_handlers_test.go @@ -5,7 +5,6 @@ import ( "io/fs" "math/rand" "os" - "reflect" "testing" ) @@ -227,12 +226,21 @@ func TestHandleGetUserNameList(t *testing.T) { Icon: &[]byte{0, 2}, Flags: &[]byte{0, 3}, UserName: []byte{0, 4}, + Agreed: true, }, uint16(2): { ID: &[]byte{0, 2}, Icon: &[]byte{0, 2}, Flags: &[]byte{0, 3}, UserName: []byte{0, 4}, + Agreed: true, + }, + uint16(3): { + ID: &[]byte{0, 3}, + Icon: &[]byte{0, 2}, + Flags: &[]byte{0, 3}, + UserName: []byte{0, 4}, + Agreed: false, }, }, }, @@ -272,9 +280,7 @@ func TestHandleGetUserNameList(t *testing.T) { t.Errorf("HandleGetUserNameList() error = %v, wantErr %v", err, tt.wantErr) return } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("HandleGetUserNameList() got = %v, want %v", got, tt.want) - } + assert.Equal(t, tt.want, got) }) } } -- cgit