khatru: only kill connection once.

This commit is contained in:
fiatjaf
2026-02-08 10:59:51 -03:00
parent 28bef1c990
commit a98ac0d050
+3
View File
@@ -108,7 +108,9 @@ func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
), ),
) )
killOnce := sync.Once{}
kill := func() { kill := func() {
killOnce.Do(func() {
if nil != rl.OnDisconnect { if nil != rl.OnDisconnect {
rl.OnDisconnect(ctx) rl.OnDisconnect(ctx)
} }
@@ -119,6 +121,7 @@ func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
ws.conn.Close() ws.conn.Close()
rl.removeClientAndListeners(ws) rl.removeClientAndListeners(ws)
})
} }
go func() { go func() {