From a735f5402460d982f1bf982978ff6a6ffcf90deb Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sat, 29 Apr 2023 11:14:35 +0200 Subject: [PATCH] updated WelcomeAgents func --- src/ws/init.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ws/init.go b/src/ws/init.go index 2202a40..25fb6ae 100644 --- a/src/ws/init.go +++ b/src/ws/init.go @@ -21,13 +21,14 @@ func WelcomeAgents(ws *websocket.Conn, welcome WSWelcome, t string) { connectinfo, ok := LISTENERS[welcome.Hostname] if !ok { - if t == "ps" { + switch t { + case "ps": connectinfo := ConnectionInfo{ ConnectionPS: ws, InitDate: time.Now(), } LISTENERS[welcome.Hostname] = &connectinfo - } else if t == "rr" { + case "rr": connectinfo := ConnectionInfo{ ConnectionRR: ws, InitDate: time.Now(), @@ -35,9 +36,10 @@ func WelcomeAgents(ws *websocket.Conn, welcome WSWelcome, t string) { LISTENERS[welcome.Hostname] = &connectinfo } } else { - if t == "ps" { + switch t { + case "ps": connectinfo.ConnectionPS = ws - } else if t == "rr" { + case "rr": connectinfo.ConnectionRR = ws } }