Skip to content

Commit

Permalink
Add shutdown function (#256)
Browse files Browse the repository at this point in the history
* Add shutdown function

* Add macros to license finder
  • Loading branch information
njooma authored Aug 26, 2024
1 parent 514364b commit a94beaa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
6 changes: 6 additions & 0 deletions doc/dependency_decisions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,9 @@
:why: License is Apache License, Version 2.0
:versions: []
:when: 2024-05-16 20:49:48.048674000 Z
- - :approve
- _macros
- :who: njooma
:why: License is BSD 3-Clause
:versions: []
:when: 2024-08-26 20:13:45.308837000 Z
16 changes: 0 additions & 16 deletions lib/src/rpc/dial.dart
Original file line number Diff line number Diff line change
Expand Up @@ -612,19 +612,3 @@ _HostAndPort _hostAndPort(String address, bool insecure) {
}
return _HostAndPort(host, port);
}

/// A channel that adds session data (if required) to gRPC metadata for every call
class ClientChannelWithSessions extends GrpcOrGrpcWebClientChannel {
final String Function() _sessionId;

ClientChannelWithSessions.toSingleEndpoint(this._sessionId, {required super.host, required super.port, required super.transportSecure})
: super.toSingleEndpoint();

@override
ClientCall<Q, R> createCall<Q, R>(ClientMethod<Q, R> method, Stream<Q> requests, CallOptions options) {
if (!SessionsClient.unallowedMethods.contains(method.path)) {
options = options.mergedWith(CallOptions(metadata: {SessionsClient.sessionMetadataKey: _sessionId()}));
}
return super.createCall(method, requests, options);
}
}
7 changes: 7 additions & 0 deletions lib/src/rpc/web_rtc/web_rtc_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ class WebRtcClientChannel extends ClientChannelBase {
options = options.mergedWith(CallOptions(metadata: {'viam_client': getVersionMetadata()}));
return super.createCall(method, requests, options);
}

@override
Future<void> shutdown() async {
await rtcPeerConnection.close();
await dataChannel.close();
return super.shutdown();
}
}

0 comments on commit a94beaa

Please sign in to comment.