tmpchat

commit 92088b1e84b306d8d1b27270fc1e6bddf96c0d20

tree

parent:
58e4137ba9e5f0e97606b1477ee1c6b450433b00

nmyk <nick@nmyk.io>

2023-01-09T11:33:26-05:00

remove hilarious bug where you can just assume someone elses user id

diff --git a/tmpchat.go b/tmpchat.go
index 2baf5590c43041b8caab7ce060f8bb73d752fd82..d6e3f58bb08747c02ebfbc2dc586bc034cc10c9e 100644
--- a/tmpchat.go
+++ b/tmpchat.go
@@ -56,6 +56,9 @@ 	return member, ok
 }
 
 func (m *Members) Set(id string, member *websocket.Conn) {
+	if _, exists := m.Get(id); exists {
+		return
+	}
 	m.Lock()
 	m.m[id] = member
 	m.Unlock()