Fix travis
This commit is contained in:
parent
7f38d181a1
commit
229b5e7205
7 changed files with 50 additions and 43 deletions
|
@ -1,5 +1,6 @@
|
|||
# 2.0.3
|
||||
* Remove `WebSocketController.plugin`.
|
||||
* Remove any unawaited futures.
|
||||
|
||||
# 2.0.2
|
||||
* Update `stream_channel` to `2.0.0`.
|
||||
|
|
|
@ -2,5 +2,3 @@ include: package:pedantic/analysis_options.yaml
|
|||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
errors:
|
||||
unawaited_futures: ignore
|
|
@ -46,7 +46,7 @@ main(List<String> args) async {
|
|||
}
|
||||
|
||||
var http2 = new AngelHttp2(app, ctx);
|
||||
http2.onHttp1.forEach(http.handleRequest);
|
||||
http2.onHttp1.listen(http.handleRequest);
|
||||
await http2.startServer('127.0.0.1', 3000);
|
||||
print('Listening at ${http2.uri}');
|
||||
} else {
|
||||
|
|
|
@ -95,13 +95,15 @@ abstract class BaseWebSocketClient extends BaseAngelClient {
|
|||
@override
|
||||
Future close() async {
|
||||
on._close();
|
||||
scheduleMicrotask(() async {
|
||||
await _socket.sink.close(status.goingAway);
|
||||
_onData.close();
|
||||
_onAllEvents.close();
|
||||
_onAuthenticated.close();
|
||||
_onError.close();
|
||||
_onServiceEvent.close();
|
||||
_onWebSocketChannelException.close();
|
||||
await _onData.close();
|
||||
await _onAllEvents.close();
|
||||
await _onAuthenticated.close();
|
||||
await _onError.close();
|
||||
await _onServiceEvent.close();
|
||||
await _onWebSocketChannelException.close();
|
||||
});
|
||||
}
|
||||
|
||||
/// Connects the WebSocket. [timeout] is optional.
|
||||
|
@ -119,7 +121,8 @@ abstract class BaseWebSocketClient extends BaseAngelClient {
|
|||
}
|
||||
});
|
||||
|
||||
getConnectedWebSocket().then((socket) {
|
||||
scheduleMicrotask(() {
|
||||
return getConnectedWebSocket().then((socket) {
|
||||
if (!c.isCompleted) {
|
||||
if (timer.isActive) timer.cancel();
|
||||
|
||||
|
@ -136,6 +139,7 @@ abstract class BaseWebSocketClient extends BaseAngelClient {
|
|||
c.completeError(e, st);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return await c.future.then((socket) {
|
||||
_socket = socket;
|
||||
|
@ -293,13 +297,13 @@ class WebSocketsService<Id, Data> extends Service<Id, Data> {
|
|||
}
|
||||
|
||||
Future close() async {
|
||||
_onAllEvents.close();
|
||||
_onCreated.close();
|
||||
_onIndexed.close();
|
||||
_onModified.close();
|
||||
_onRead.close();
|
||||
_onRemoved.close();
|
||||
_onUpdated.close();
|
||||
await _onAllEvents.close();
|
||||
await _onCreated.close();
|
||||
await _onIndexed.close();
|
||||
await _onModified.close();
|
||||
await _onRead.close();
|
||||
await _onRemoved.close();
|
||||
await _onUpdated.close();
|
||||
}
|
||||
|
||||
/// Serializes an [action] to be sent over a WebSocket.
|
||||
|
|
|
@ -387,7 +387,7 @@ class AngelWebSocket {
|
|||
var ws = await WebSocketTransformer.upgrade(req.rawRequest);
|
||||
var channel = new IOWebSocketChannel(ws);
|
||||
var socket = new WebSocketContext(channel, req, res);
|
||||
handleClient(socket);
|
||||
scheduleMicrotask(() => handleClient(socket));
|
||||
return false;
|
||||
} else if (req is Http2RequestContext && res is Http2ResponseContext) {
|
||||
var connection =
|
||||
|
@ -428,9 +428,9 @@ class AngelWebSocket {
|
|||
});
|
||||
|
||||
if (req.hasParsedBody) {
|
||||
ctrl.local.sink.close();
|
||||
await ctrl.local.sink.close();
|
||||
} else {
|
||||
req.body.pipe(ctrl.local.sink);
|
||||
await req.body.pipe(ctrl.local.sink);
|
||||
}
|
||||
|
||||
var sink = utf8.encoder.startChunkedConversion(ctrl.foreign.sink);
|
||||
|
@ -443,7 +443,7 @@ class AngelWebSocket {
|
|||
|
||||
var ws = new WebSocketChannel(ctrl.foreign);
|
||||
var socket = new WebSocketContext(ws, req, res);
|
||||
handleClient(socket);
|
||||
scheduleMicrotask(() => handleClient(socket));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -40,12 +40,14 @@ class WebSocketContext {
|
|||
|
||||
/// Closes the underlying [StreamChannel].
|
||||
Future close() async {
|
||||
scheduleMicrotask(() async {
|
||||
await channel.sink.close();
|
||||
_onAction.close();
|
||||
_onAuthenticated.close();
|
||||
_onData.close();
|
||||
_onClose.add(null);
|
||||
_onClose.close();
|
||||
await _onAction.close();
|
||||
await _onAuthenticated.close();
|
||||
await _onData.close();
|
||||
await _onClose.add(null);
|
||||
await _onClose.close();
|
||||
});
|
||||
}
|
||||
|
||||
/// Sends an arbitrary [WebSocketEvent];
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:angel_framework/angel_framework.dart';
|
||||
import 'package:angel_model/angel_model.dart';
|
||||
import 'package:angel_websocket/base_websocket_client.dart';
|
||||
|
@ -23,7 +25,7 @@ class TodoService extends MapService {
|
|||
|
||||
testIndex(BaseWebSocketClient client) async {
|
||||
var todoService = client.service('api/todos');
|
||||
todoService.index();
|
||||
scheduleMicrotask(() => todoService.index());
|
||||
|
||||
var indexed = await todoService.onIndexed.first;
|
||||
print('indexed: $indexed');
|
||||
|
|
Loading…
Reference in a new issue