don't throw on closing channel not open (#128)

Don't throw on closing channel not open
This commit is contained in:
Alexandre Ardhuin 2018-11-12 14:54:11 +01:00 committed by Sigurd Meldgaard
parent c252ada1a5
commit 921f4df0b9
3 changed files with 11 additions and 6 deletions

View File

@ -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.

View File

@ -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<Null> shutdown() {
if (_isShutdown) return new Future.value();
Future<void> 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<Null> terminate() {
Future<void> terminate() async {
_isShutdown = true;
return _connection.terminate();
if (_connection != null) await _connection.terminate();
}
/// Returns a connection to this [Channel]'s RPC endpoint.

View File

@ -1,6 +1,6 @@
name: grpc
description: Dart implementation of gRPC.
version: 0.6.7
version: 0.6.8
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/grpc-dart