mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-29 11:12:04 +01:00
guard ping writes with the mutex.
fixes https://github.com/nbd-wtf/go-nostr/issues/76#issuecomment-1521170395
This commit is contained in:
parent
b077a41f83
commit
3838ed7e91
2
relay.go
2
relay.go
@ -119,7 +119,9 @@ func (r *Relay) Connect(ctx context.Context) error {
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
conn.mutex.Lock()
|
||||
err := conn.socket.WriteMessage(websocket.PingMessage, nil)
|
||||
conn.mutex.Unlock()
|
||||
if err != nil {
|
||||
InfoLogger.Printf("{%s} error writing ping: %v; closing websocket", r.URL, err)
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user