mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-09-11 09:06:52 +02:00
add closure queue channel that was missing.
This commit is contained in:
4
relay.go
4
relay.go
@@ -74,6 +74,7 @@ func NewRelay(ctx context.Context, url string, opts ...RelayOption) *Relay {
|
|||||||
Subscriptions: xsync.NewMapOf[*Subscription](),
|
Subscriptions: xsync.NewMapOf[*Subscription](),
|
||||||
okCallbacks: xsync.NewMapOf[func(bool, string)](),
|
okCallbacks: xsync.NewMapOf[func(bool, string)](),
|
||||||
writeQueue: make(chan writeRequest),
|
writeQueue: make(chan writeRequest),
|
||||||
|
subscriptionChannelCloseQueue: make(chan *Subscription),
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
@@ -141,7 +142,7 @@ func (_ WithAuthHandler) IsRelayOption() {}
|
|||||||
|
|
||||||
var _ RelayOption = (WithAuthHandler)(nil)
|
var _ RelayOption = (WithAuthHandler)(nil)
|
||||||
|
|
||||||
// String() just prints the relay URL.
|
// String just returns the relay URL.
|
||||||
func (r *Relay) String() string {
|
func (r *Relay) String() string {
|
||||||
return r.URL
|
return r.URL
|
||||||
}
|
}
|
||||||
@@ -480,6 +481,7 @@ func (r *Relay) PrepareSubscription(ctx context.Context, filters Filters, opts .
|
|||||||
}
|
}
|
||||||
|
|
||||||
id := sub.GetID()
|
id := sub.GetID()
|
||||||
|
|
||||||
r.Subscriptions.Store(id, sub)
|
r.Subscriptions.Store(id, sub)
|
||||||
|
|
||||||
// the subscription ends once the context is canceled
|
// the subscription ends once the context is canceled
|
||||||
|
Reference in New Issue
Block a user