mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-23 15:08:07 +02:00
fix: increase default timeouts and ensure they are applied to XtreamService
This commit is contained in:
1 parent
16b4bfc17a
commit
36a74d9e97
3 files changed
+16
-6
No files matched your search
@@ -19,9 +19,9 @@ enum BufferSize {
|
|||||||
|
|
||||||
/// Connection timeout presets
|
/// Connection timeout presets
|
||||||
enum ConnectionTimeout {
|
enum ConnectionTimeout {
|
||||||
short, // 15 seconds
|
short, // 30 seconds
|
||||||
medium, // 30 seconds
|
medium, // 60 seconds
|
||||||
long, // 60 seconds
|
long, // 120 seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EPG cache duration presets
|
/// EPG cache duration presets
|
||||||
@@ -205,11 +205,11 @@ class IptvSettings {
|
|||||||
int get timeoutSeconds {
|
int get timeoutSeconds {
|
||||||
switch (connectionTimeout) {
|
switch (connectionTimeout) {
|
||||||
case ConnectionTimeout.short:
|
case ConnectionTimeout.short:
|
||||||
return 15;
|
|
||||||
case ConnectionTimeout.medium:
|
|
||||||
return 30;
|
return 30;
|
||||||
case ConnectionTimeout.long:
|
case ConnectionTimeout.medium:
|
||||||
return 60;
|
return 60;
|
||||||
|
case ConnectionTimeout.long:
|
||||||
|
return 120;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ final xtreamServiceProvider =
|
|||||||
final service = XtreamService();
|
final service = XtreamService();
|
||||||
final settings = ref.watch(iptvSettingsProvider);
|
final settings = ref.watch(iptvSettingsProvider);
|
||||||
service.setBackendUrl(settings.backendUrl);
|
service.setBackendUrl(settings.backendUrl);
|
||||||
|
service.updateTimeouts(settings.timeoutSeconds);
|
||||||
service.setPlaylist(playlist);
|
service.setPlaylist(playlist);
|
||||||
ref.onDispose(() => service.dispose());
|
ref.onDispose(() => service.dispose());
|
||||||
return service;
|
return service;
|
||||||
@@ -62,6 +63,8 @@ final activeXtreamServiceProvider = Provider<XtreamService>((ref) {
|
|||||||
|
|
||||||
if (playlist != null) {
|
if (playlist != null) {
|
||||||
service.setPlaylist(playlist);
|
service.setPlaylist(playlist);
|
||||||
|
final settings = ref.read(iptvSettingsProvider);
|
||||||
|
service.updateTimeouts(settings.timeoutSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
|
|||||||
@@ -69,6 +69,13 @@ class XtreamService {
|
|||||||
_manualBackendUrl = url;
|
_manualBackendUrl = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Update connection timeouts
|
||||||
|
void updateTimeouts(int seconds) {
|
||||||
|
_dio.options.connectTimeout = Duration(seconds: seconds);
|
||||||
|
_dio.options.receiveTimeout = Duration(seconds: seconds);
|
||||||
|
_dio.options.sendTimeout = Duration(seconds: seconds);
|
||||||
|
}
|
||||||
|
|
||||||
/// Wrap URL with proxy for all external IPTV URLs
|
/// Wrap URL with proxy for all external IPTV URLs
|
||||||
String _wrapWithProxy(String url) {
|
String _wrapWithProxy(String url) {
|
||||||
if (url.startsWith('http')) {
|
if (url.startsWith('http')) {
|
||||||
|
|||||||
Reference in new issue
Block a user