mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-07-07 22:59:54 +02:00
hopefully fix a segfault with broken connections.
This commit is contained in:
5
relay.go
5
relay.go
@ -182,6 +182,10 @@ func (r *Relay) ConnectWithTLS(ctx context.Context, tlsConfig *tls.Config) error
|
|||||||
|
|
||||||
// stop the ticker
|
// stop the ticker
|
||||||
ticker.Stop()
|
ticker.Stop()
|
||||||
|
|
||||||
|
// nil the connection
|
||||||
|
r.Connection = nil
|
||||||
|
|
||||||
// close all subscriptions
|
// close all subscriptions
|
||||||
r.Subscriptions.Range(func(_ string, sub *Subscription) bool {
|
r.Subscriptions.Range(func(_ string, sub *Subscription) bool {
|
||||||
go sub.Unsub()
|
go sub.Unsub()
|
||||||
@ -520,7 +524,6 @@ func (r *Relay) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
err := r.Connection.Close()
|
err := r.Connection.Close()
|
||||||
r.Connection = nil
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user