From 0393703f586b8ca76380f447f44e240f4f88323f Mon Sep 17 00:00:00 2001 From: Jakob Andersen Date: Wed, 28 Mar 2018 14:54:09 +0200 Subject: [PATCH] Ensure shutdown and terminate always return a Future. (#75) Even if _transport.finish()/terminate() returns some other kind of Future. --- lib/src/client/connection.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/client/connection.dart b/lib/src/client/connection.dart index 6386dcd..770abaa 100644 --- a/lib/src/client/connection.dart +++ b/lib/src/client/connection.dart @@ -184,19 +184,19 @@ class ClientConnection { /// /// No further calls may be made on this connection, but existing calls /// are allowed to finish. - Future shutdown() { - if (_state == ConnectionState.shutdown) return new Future.value(); + Future shutdown() async { + if (_state == ConnectionState.shutdown) return null; _setShutdownState(); - return _transport?.finish() ?? new Future.value(); + await _transport?.finish(); } /// Terminates this connection. /// /// All open calls are terminated immediately, and no further calls may be /// made on this connection. - Future terminate() { + Future terminate() async { _setShutdownState(); - return _transport?.terminate() ?? new Future.value(); + await _transport?.terminate(); } void _setShutdownState() {