From e0b5d92671e56f31bbe241054779486a00702aad Mon Sep 17 00:00:00 2001 From: Kane York Date: Fri, 15 Sep 2017 12:57:22 -0700 Subject: [PATCH 1/2] Allow a null client_id --- socketserver/server/commands.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/socketserver/server/commands.go b/socketserver/server/commands.go index efef59c2..6bb3ca5f 100644 --- a/socketserver/server/commands.go +++ b/socketserver/server/commands.go @@ -136,7 +136,7 @@ func C2SHello(conn *websocket.Conn, client *ClientInfo, msg ClientMessage) (rmsg if client.ClientID == uuid.Nil { client.ClientID = uuid.NewV4() } - } else if _, ok := ary[1].(bool); ok { + } else if _, ok := ary[1].(bool); (ok || ary[1] == nil) { // opt out client.ClientID = AnonymousClientID } else { From 42c82251bea3ec1509a1bb3fcfa8494126f94899 Mon Sep 17 00:00:00 2001 From: Kane York Date: Fri, 15 Sep 2017 12:58:14 -0700 Subject: [PATCH 2/2] Assign new client ID when null --- socketserver/server/commands.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/socketserver/server/commands.go b/socketserver/server/commands.go index 6bb3ca5f..6f67fe4e 100644 --- a/socketserver/server/commands.go +++ b/socketserver/server/commands.go @@ -136,9 +136,11 @@ func C2SHello(conn *websocket.Conn, client *ClientInfo, msg ClientMessage) (rmsg if client.ClientID == uuid.Nil { client.ClientID = uuid.NewV4() } - } else if _, ok := ary[1].(bool); (ok || ary[1] == nil) { + } else if _, ok := ary[1].(bool); ok { // opt out client.ClientID = AnonymousClientID + } else if ary[1] == nil { + client.ClientID = uuid.NewV4() } else { err = ErrExpectedTwoStrings return