mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-12-05 10:21:32 +01:00
primitive support for CLOSED in SimplePool.
This commit is contained in:
7
pool.go
7
pool.go
@@ -3,6 +3,7 @@ package nostr
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -116,6 +117,9 @@ func (pool *SimplePool) subMany(ctx context.Context, urls []string, filters Filt
|
||||
}
|
||||
}
|
||||
case events <- IncomingEvent{Event: evt, Relay: relay}:
|
||||
case reason := <-sub.ClosedReason:
|
||||
log.Printf("CLOSED from %s: '%s'\n", nm, reason)
|
||||
return
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
@@ -177,6 +181,9 @@ func (pool *SimplePool) subManyEose(ctx context.Context, urls []string, filters
|
||||
return
|
||||
case <-sub.EndOfStoredEvents:
|
||||
return
|
||||
case reason := <-sub.ClosedReason:
|
||||
log.Printf("CLOSED from %s: '%s'\n", nm, reason)
|
||||
return
|
||||
case evt, more := <-sub.Events:
|
||||
if !more {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user