Skip to content

Commit

Permalink
Merge pull request #100 from eclipse-thingweb/_clientForUriScheme-ref…
Browse files Browse the repository at this point in the history
…actor

refactor(thing_discovery): refactor _clientForUriScheme
  • Loading branch information
JKRhb authored Jan 12, 2024
2 parents 2ee7d0b + 97a20ba commit 231bf03
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/src/core/implementation/thing_discovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,15 @@ class ThingDiscovery extends Stream<ThingDescription>

ProtocolClient _clientForUriScheme(Uri uri) {
final uriScheme = uri.scheme;
var client = _clients[uriScheme];
final existingClient = _clients[uriScheme];

if (client == null) {
client = _servient.clientFor(uriScheme);
_clients[uriScheme] = client;
if (existingClient != null) {
return existingClient;
}

return client;
final newClient = _servient.clientFor(uriScheme);
_clients[uriScheme] = newClient;
return newClient;
}

@override
Expand Down

0 comments on commit 231bf03

Please sign in to comment.