From a00e0779c9036f0a25d2bf4a8ae5aef0d5f8603e Mon Sep 17 00:00:00 2001 From: Gary Roumanis Date: Mon, 6 Jan 2020 15:51:27 -0800 Subject: [PATCH] Make isInKeepAlivePeriod as private (#20) * Make isInKeepAlivePeriod as private * fix doc * fix markdown --- CHANGELOG.md | 11 +++++++++-- lib/src/server/sse_handler.dart | 8 ++++---- pubspec.yaml | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 022f12028de6a..d5847334c4539 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 3.1.1 + +- Make `isInKeepAlive` on `SseConnection` private. + +**Note that this is a breaking change but in actuality no one should be + depending on this API.** + ## 3.1.0 - Add optional `keepAlive` parameter to the `SseHandler`. If `keepAlive` is @@ -9,8 +16,8 @@ - Add retry logic. -** Possible Breaking Change ** Error messages may now be delayed up to 5 seconds -in the client. +**Possible Breaking Change Error messages may now be delayed up to 5 seconds + in the client.** ## 2.1.2 diff --git a/lib/src/server/sse_handler.dart b/lib/src/server/sse_handler.dart index e8cd523b93277..9c3d91eb0eb03 100644 --- a/lib/src/server/sse_handler.dart +++ b/lib/src/server/sse_handler.dart @@ -37,7 +37,7 @@ class SseConnection extends StreamChannelMixin { Timer _keepAliveTimer; /// Whether this connection is currently in the KeepAlive timeout period. - bool get isInKeepAlivePeriod => _keepAliveTimer?.isActive ?? false; + bool get _isInKeepAlivePeriod => _keepAliveTimer?.isActive ?? false; final _closedCompleter = Completer(); @@ -60,7 +60,7 @@ class SseConnection extends StreamChannelMixin { while (await outgoingStreamQueue.hasNext) { // If we're in a KeepAlive timeout, there's nowhere to send messages so // wait a short period and check again. - if (isInKeepAlivePeriod) { + if (_isInKeepAlivePeriod) { await Future.delayed(const Duration(milliseconds: 200)); continue; } @@ -105,7 +105,7 @@ class SseConnection extends StreamChannelMixin { if (_keepAlive == null) { // Close immediately if we're not keeping alive. _close(); - } else if (!isInKeepAlivePeriod) { + } else if (!_isInKeepAlivePeriod) { // Otherwise if we didn't already have an active timer, set a timer to // close after the timeout period. If the connection comes back, this will // be cancelled and all messages left in the queue tried again. @@ -155,7 +155,7 @@ class SseHandler { // Check if we already have a connection for this ID that is in the process // of timing out (in which case we can reconnect it transparently). if (_connections[clientId] != null && - _connections[clientId].isInKeepAlivePeriod) { + _connections[clientId]._isInKeepAlivePeriod) { _connections[clientId]._acceptReconnection(sink); } else { var connection = SseConnection(sink, keepAlive: _keepAlive); diff --git a/pubspec.yaml b/pubspec.yaml index 9c164f79e7ce8..52d69e5f2411e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sse -version: 3.1.0 +version: 3.1.1 author: Dart Team homepage: https://github.com/dart-lang/sse description: >-