diff --git a/CHANGELOG.md b/CHANGELOG.md index b42a580..c537406 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.6.8 + +* Calling `terminate()` or `shutdown()` on a channel doesn't throw error if the +channel is not yet open. + ## 0.6.7 * Support package:test 1.5. diff --git a/lib/src/client/channel.dart b/lib/src/client/channel.dart index 95a7318..68bd22f 100644 --- a/lib/src/client/channel.dart +++ b/lib/src/client/channel.dart @@ -44,19 +44,19 @@ class ClientChannel { /// /// No further RPCs can be made on this channel. RPCs already in progress will /// be allowed to complete. - Future shutdown() { - if (_isShutdown) return new Future.value(); + Future shutdown() async { + if (_isShutdown) return; _isShutdown = true; - return _connection.shutdown(); + if (_connection != null) await _connection.shutdown(); } /// Terminates this channel. /// /// RPCs already in progress will be terminated. No further RPCs can be made /// on this channel. - Future terminate() { + Future terminate() async { _isShutdown = true; - return _connection.terminate(); + if (_connection != null) await _connection.terminate(); } /// Returns a connection to this [Channel]'s RPC endpoint. diff --git a/pubspec.yaml b/pubspec.yaml index 10e819a..ea60515 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: grpc description: Dart implementation of gRPC. -version: 0.6.7 +version: 0.6.8 author: Dart Team homepage: https://github.com/dart-lang/grpc-dart