mirror of https://github.com/grpc/grpc-dart.git
This reverts commit 9ed03b6b96.
This change prevents client from gracefully handling connection issues and instead just makes it infinitely trying to reconnect.
Closes #339
This commit is contained in:
parent
a657916168
commit
831f5d8cfb
|
|
@ -264,8 +264,9 @@ class Http2ClientConnection implements connection.ClientConnection {
|
|||
}
|
||||
// TODO(jakobr): Log error.
|
||||
_cancelTimer();
|
||||
_pendingCalls.forEach((call) => _failCall(call, error));
|
||||
_pendingCalls.clear();
|
||||
_setState(ConnectionState.idle);
|
||||
_connect();
|
||||
}
|
||||
|
||||
void _handleReconnect() {
|
||||
|
|
|
|||
|
|
@ -368,6 +368,24 @@ void main() {
|
|||
);
|
||||
}
|
||||
|
||||
test('Connection errors are reported', () async {
|
||||
final connectionStates = <ConnectionState>[];
|
||||
harness.connection.connectionError = 'Connection error';
|
||||
harness.connection.onStateChanged = (connection) {
|
||||
final state = connection.state;
|
||||
connectionStates.add(state);
|
||||
};
|
||||
|
||||
final expectedException =
|
||||
GrpcError.unavailable('Error connecting: Connection error');
|
||||
|
||||
await harness.expectThrows(
|
||||
harness.client.unary(dummyValue), expectedException);
|
||||
|
||||
expect(
|
||||
connectionStates, [ConnectionState.connecting, ConnectionState.idle]);
|
||||
});
|
||||
|
||||
test('Connections time out if idle', () async {
|
||||
final done = Completer();
|
||||
final connectionStates = <ConnectionState>[];
|
||||
|
|
|
|||
Loading…
Reference in New Issue