mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Handle StateError for closed serviceClient
In https://github.com/dart-lang/json_rpc_2/pull/52 the `Peer` class was fixed to behave like a `Client` when the connection is closed with outstanding requests. `package:dds` was previously relying on having the futures never complete to send the `serviceDisappeared` code when the client was closed with outstanding requests. Check also for the `StateError` that would result from outstanding requests and translate them to `serviceDisappeared`. Change-Id: I2d3f186d1d52d34082b7adf5bf962e22df74015b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158220 Auto-Submit: Nate Bosch <nbosch@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com> Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
parent
d16bc3a3dd
commit
3b6aeb43fa
|
@ -1,3 +1,7 @@
|
|||
# 1.3.2-dev
|
||||
|
||||
- Fix handling of requests that are outstanding when a client channel is closed.
|
||||
|
||||
# 1.3.1
|
||||
|
||||
- Fixed issue where an exception could be thrown during startup if the target
|
||||
|
|
|
@ -215,7 +215,11 @@ class _DartDevelopmentServiceClient {
|
|||
return await Future.any(
|
||||
[
|
||||
// Forward the request to the service client or...
|
||||
serviceClient.sendRequest(method, parameters.asMap),
|
||||
serviceClient.sendRequest(method, parameters.asMap).catchError((_) {
|
||||
throw _RpcErrorCodes.buildRpcException(
|
||||
_RpcErrorCodes.kServiceDisappeared,
|
||||
);
|
||||
}, test: (error) => error is StateError),
|
||||
// if the service client closes, return an error response.
|
||||
serviceClient._clientPeer.done.then(
|
||||
(_) => throw _RpcErrorCodes.buildRpcException(
|
||||
|
|
|
@ -3,7 +3,7 @@ description: >-
|
|||
A library used to spawn the Dart Developer Service, used to communicate with
|
||||
a Dart VM Service instance.
|
||||
|
||||
version: 1.3.1
|
||||
version: 1.3.2-dev
|
||||
|
||||
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/dds
|
||||
|
||||
|
|
Loading…
Reference in a new issue