@@ -5,6 +5,7 @@ import 'package:rxdart/rxdart.dart';
55
66import '../../config/bootstrap_relays.dart' ;
77import '../../config/relay_defaults.dart' ;
8+ import '../../config/request_defaults.dart' ;
89import '../../shared/decode_nostr_msg/decode_nostr_msg.dart' ;
910import '../../shared/helpers/relay_helper.dart' ;
1011import '../../shared/isolates/isolate_manager.dart' ;
@@ -51,7 +52,7 @@ class RelayManager<T> {
5152 final Map <String , Timer > _pendingAuthTimers = {};
5253
5354 /// timeout for AUTH callbacks (how long to wait for AUTH OK)
54- static const Duration _authCallbackTimeout = Duration (seconds : 30 ) ;
55+ final Duration authCallbackTimeout ;
5556
5657 /// nostr transport factory, to create new transports (usually websocket)
5758 final NostrTransportFactory nostrTransportFactory;
@@ -82,6 +83,7 @@ class RelayManager<T> {
8283 List <String >? bootstrapRelays,
8384 allowReconnect = true ,
8485 this .eagerAuth = false ,
86+ this .authCallbackTimeout = RequestDefaults .DEFAULT_AUTH_CALLBACK_TIMEOUT ,
8587 }) : _accounts = accounts {
8688 allowReconnectRelays = allowReconnect;
8789 _connectSeedRelays (urls: bootstrapRelays ?? DEFAULT_BOOTSTRAP_RELAYS );
@@ -779,7 +781,7 @@ class RelayManager<T> {
779781 };
780782
781783 // Start timeout timer to clean up orphaned callbacks
782- _pendingAuthTimers[signedAuth.id] = Timer (_authCallbackTimeout , () {
784+ _pendingAuthTimers[signedAuth.id] = Timer (authCallbackTimeout , () {
783785 Logger .log.w (
784786 "AUTH callback timeout for ${signedAuth .id } on ${relayConnectivity .url }" );
785787 _pendingAuthCallbacks.remove (signedAuth.id);
@@ -854,7 +856,7 @@ class RelayManager<T> {
854856 };
855857
856858 // Start timeout timer to clean up orphaned callbacks
857- _pendingAuthTimers[signedAuth.id] = Timer (_authCallbackTimeout , () {
859+ _pendingAuthTimers[signedAuth.id] = Timer (authCallbackTimeout , () {
858860 Logger .log.w (
859861 "AUTH callback timeout for ${signedAuth .id } on ${relayConnectivity .url }" );
860862 _pendingAuthCallbacks.remove (signedAuth.id);
0 commit comments