Skip to content

Commit

Permalink
refactor(thing_discovery): refactor _clientForUriScheme
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Jan 12, 2024
1 parent 2ee7d0b commit 97a20ba
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 97a20ba

Please sign in to comment.