fix closing of closed ws.Authed channel when client AUTHs twice.

This commit is contained in:
fiatjaf
2023-12-27 12:30:23 -03:00
parent 5b17786273
commit 21b08cb044
3 changed files with 10 additions and 2 deletions

View File

@@ -14,6 +14,9 @@ const (
func RequestAuth(ctx context.Context) {
ws := GetConnection(ctx)
ws.authLock.Lock()
ws.Authed = make(chan struct{})
ws.authLock.Unlock()
ws.WriteJSON(nostr.AuthEnvelope{Challenge: &ws.Challenge})
}