mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-11-18 18:16:50 +01:00
try to reconnect even if the first connection failed.
fixes https://github.com/nbd-wtf/go-nostr/issues/193
This commit is contained in:
7
pool.go
7
pool.go
@@ -445,7 +445,6 @@ func (pool *SimplePool) subMany(
|
|||||||
}
|
}
|
||||||
|
|
||||||
eosed := atomic.Bool{}
|
eosed := atomic.Bool{}
|
||||||
firstConnection := true
|
|
||||||
|
|
||||||
go func(nm string) {
|
go func(nm string) {
|
||||||
defer func() {
|
defer func() {
|
||||||
@@ -484,16 +483,10 @@ func (pool *SimplePool) subMany(
|
|||||||
|
|
||||||
relay, err := pool.EnsureRelay(nm)
|
relay, err := pool.EnsureRelay(nm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if we never connected to this just fail
|
|
||||||
if firstConnection {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise (if we were connected and got disconnected) keep trying to reconnect
|
// otherwise (if we were connected and got disconnected) keep trying to reconnect
|
||||||
debugLogf("%s reconnecting because connection failed\n", nm)
|
debugLogf("%s reconnecting because connection failed\n", nm)
|
||||||
goto reconnect
|
goto reconnect
|
||||||
}
|
}
|
||||||
firstConnection = false
|
|
||||||
hasAuthed = false
|
hasAuthed = false
|
||||||
|
|
||||||
subscribe:
|
subscribe:
|
||||||
|
|||||||
Reference in New Issue
Block a user