mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-11-18 18:16:50 +01:00
protect against faulty relays that send more than one EOSE halting us
using sync.Once{} to only emit to the EndOfStoredEvents channel once
(it has capacity 1 so anything over that would halt).
This commit is contained in:
4
relay.go
4
relay.go
@@ -140,7 +140,9 @@ func (r *Relay) Connect() error {
|
||||
var channel string
|
||||
json.Unmarshal(jsonMessage[1], &channel)
|
||||
if subscription, ok := r.subscriptions.Load(channel); ok {
|
||||
subscription.EndOfStoredEvents <- struct{}{}
|
||||
subscription.emitEose.Do(func() {
|
||||
subscription.EndOfStoredEvents <- struct{}{}
|
||||
})
|
||||
}
|
||||
case "OK":
|
||||
if len(jsonMessage) < 3 {
|
||||
|
||||
Reference in New Issue
Block a user