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