Skip to content

Commit cb6b083

Browse files
jakobr-googlemkustermann
authored andcommitted
Remove use of new Function syntax for onActiveStateChanged. (dart-archive/http2#16)
The new syntax isn't fully supported in 1.24, so switching back to good old typedef. Fixes dart-lang/http2#14.
1 parent ced4807 commit cb6b083

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

pkgs/http2/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.1.5
4+
5+
* Removed use of new `Function` syntax, since it isn't fully supported in Dart
6+
1.24.
7+
38
## 0.1.4
49

510
* Added an `onActiveStateChanged` callback to `Connection`, which is invoked when

pkgs/http2/lib/src/connection.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ abstract class Connection {
7373
final bool isClientConnection;
7474

7575
/// Active state handler for this connection.
76-
void Function(bool isActive) onActiveStateChanged;
76+
ActiveStateHandler onActiveStateChanged;
7777

7878
/// The HPack context for this connection.
7979
final HPackContext _hpackContext = new HPackContext();

pkgs/http2/lib/src/streams/stream_handler.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class StreamHandler extends Object with TerminatableMixin, ClosableMixin {
149149

150150
bool get ranOutOfStreamIds => _ranOutOfStreamIds();
151151

152-
final void Function(bool isActive) _onActiveStateChanged;
152+
final ActiveStateHandler _onActiveStateChanged;
153153

154154
StreamHandler._(
155155
this._frameWriter,
@@ -167,7 +167,7 @@ class StreamHandler extends Object with TerminatableMixin, ClosableMixin {
167167
ConnectionMessageQueueOut outgoingQueue,
168168
ActiveSettings peerSettings,
169169
ActiveSettings localSettings,
170-
void Function(bool isActive) onActiveStateChanged) {
170+
ActiveStateHandler onActiveStateChanged) {
171171
return new StreamHandler._(writer, incomingQueue, outgoingQueue,
172172
peerSettings, localSettings, onActiveStateChanged, 1, 0);
173173
}
@@ -178,7 +178,7 @@ class StreamHandler extends Object with TerminatableMixin, ClosableMixin {
178178
ConnectionMessageQueueOut outgoingQueue,
179179
ActiveSettings peerSettings,
180180
ActiveSettings localSettings,
181-
void Function(bool isActive) onActiveStateChanged) {
181+
ActiveStateHandler onActiveStateChanged) {
182182
return new StreamHandler._(writer, incomingQueue, outgoingQueue,
183183
peerSettings, localSettings, onActiveStateChanged, 2, -1);
184184
}

pkgs/http2/lib/transport.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ import 'src/hpack/hpack.dart' show Header;
106106

107107
export 'src/hpack/hpack.dart' show Header;
108108

109+
typedef void ActiveStateHandler(bool isActive);
110+
109111
/// Settings for a [TransportConnection].
110112
abstract class Settings {
111113
/// The maximum number of concurrent streams the remote end can open
@@ -152,7 +154,7 @@ abstract class TransportConnection {
152154
/// goes from 0 to 1 (the connection goes from idle to active), and with
153155
/// [false] when the number of active streams becomes 0 (the connection goes
154156
/// from active to idle).
155-
set onActiveStateChanged(void Function(bool isActive) callback);
157+
set onActiveStateChanged(ActiveStateHandler callback);
156158

157159
/// Finish this connection.
158160
///

pkgs/http2/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: http2
2-
version: 0.1.5-dev
2+
version: 0.1.5
33
description: A HTTP/2 implementation in Dart.
44
author: Dart Team <[email protected]>
55
homepage: https://github.com/dart-lang/http2

0 commit comments

Comments
 (0)