mirror of
https://github.com/fiatjaf/nak.git
synced 2024-10-30 09:09:08 -04:00
close relay websockets cleanly.
This commit is contained in:
parent
637b9440ef
commit
a30f422d7d
6
event.go
6
event.go
|
@ -108,6 +108,12 @@ example:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
for _, relay := range relays {
|
||||||
|
relay.Close()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
// gather the secret key
|
// gather the secret key
|
||||||
sec, err := gatherSecretKeyFromArguments(c)
|
sec, err := gatherSecretKeyFromArguments(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
10
fetch.go
10
fetch.go
|
@ -24,6 +24,15 @@ var fetch = &cli.Command{
|
||||||
},
|
},
|
||||||
ArgsUsage: "[nip19code]",
|
ArgsUsage: "[nip19code]",
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
|
pool := nostr.NewSimplePool(c.Context)
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
pool.Relays.Range(func(_ string, relay *nostr.Relay) bool {
|
||||||
|
relay.Close()
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}()
|
||||||
|
|
||||||
for code := range getStdinLinesOrFirstArgument(c) {
|
for code := range getStdinLinesOrFirstArgument(c) {
|
||||||
filter := nostr.Filter{}
|
filter := nostr.Filter{}
|
||||||
|
|
||||||
|
@ -67,7 +76,6 @@ var fetch = &cli.Command{
|
||||||
authorHint = v
|
authorHint = v
|
||||||
}
|
}
|
||||||
|
|
||||||
pool := nostr.NewSimplePool(c.Context)
|
|
||||||
if authorHint != "" {
|
if authorHint != "" {
|
||||||
relayList := sdk.FetchRelaysForPubkey(c.Context, pool, authorHint,
|
relayList := sdk.FetchRelaysForPubkey(c.Context, pool, authorHint,
|
||||||
"wss://purplepag.es", "wss://relay.damus.io", "wss://relay.noswhere.com",
|
"wss://purplepag.es", "wss://relay.damus.io", "wss://relay.noswhere.com",
|
||||||
|
|
6
req.go
6
req.go
|
@ -135,6 +135,12 @@ example:
|
||||||
for i, relay := range relays {
|
for i, relay := range relays {
|
||||||
relayUrls[i] = relay.URL
|
relayUrls[i] = relay.URL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
for _, relay := range relays {
|
||||||
|
relay.Close()
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
for stdinFilter := range getStdinLinesOrBlank() {
|
for stdinFilter := range getStdinLinesOrBlank() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user