Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable timeouts #8

Open
kostadin24 opened this issue Jan 17, 2023 · 4 comments
Open

Configurable timeouts #8

kostadin24 opened this issue Jan 17, 2023 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@kostadin24
Copy link

kostadin24 commented Jan 17, 2023

Hello
From time to time I see timeouts:

TimeoutException after 0:00:10.000000: Future not completed - http://192.168.1.104/2_v4_upnp_device_desc.xml
TimeoutException after 0:00:10.000000: Future not completed - http://192.168.1.113:6661/
TimeoutException after 0:00:10.000000: Future not completed - http://192.168.1.1:49152/IGDdevicedesc.xml
TimeoutException after 0:00:10.000000: Future not completed - http://192.168.1.1:49154/description.xml

It happens on random manner. Sometimes I see them, sometime not. I saw timeout values in library, but can not find way to configure them.
Most frequently I see this for router. Like too much services to process.
Can we configure timeouts?

@daniel-naegele
Copy link
Owner

Do you have some more logs? Any code for reproducing the error?

@kostadin24
Copy link
Author

Future<List> findAllServices(int secondsDuration) async {
if (_loggingEnabled)
print('### ${DateTime.now()} Start SSDP scan');

DeviceDiscoverer discoverer = DeviceDiscoverer();
final Duration duration = Duration(seconds: secondsDuration);
await discoverer.start(ipv4: true, ipv6: false);

List<SSDPService> services = [];

discoverer.quickDiscoverClients().listen((client) async {
try {
  final dev = await client.getDevice();
  if (dev != null) {
	var metadata = _parseMetadata(dev);
	services.add(SSDPService(dev.friendlyName ?? '', dev.deviceType ?? '', dev.url ?? '', metadata, 'SSDP', dev.manufacturer, dev.modelName));
 }
} catch (e) {
	print('[SSDPServiceDiscoverer] ERROR: $e - ${client.location} ');
}
});

await Future.delayed(duration);

discoverer.stop();
if (_loggingEnabled)
  print('### ${DateTime.now()} End SSDP scan');
return services;

}

@kostadin24
Copy link
Author

kostadin24 commented Jan 17, 2023

Strange moment is that if I replace:
discoverer.quickDiscoverClients().listen((client) async {
with
List<DiscoveredClient> clients = await discoverer.quickDiscoverClients().toList();
no more timeouts printed in logs.
Like Flutter can not handle too many async calls in parallel. Waiting to get list and then to call getDevice is longer, but in my case fixes the issue.

@daniel-naegele
Copy link
Owner

That seems odd, but configurable timeouts still seem like a good enhancement.

@daniel-naegele daniel-naegele added enhancement New feature or request good first issue Good for newcomers labels Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants