Skip to content

Commit

Permalink
✅ --
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Apr 14, 2024
1 parent eecde29 commit 6b26185
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugins/http2_adapter/lib/src/http2_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class Http2Adapter implements HttpClientAdapter {
requestStreamFuture = requestStreamFuture.timeout(
sendTimeout,
onTimeout: () async {
await stream.outgoingMessages.close().catchError((_) {});
stream.outgoingMessages.close().catchError((_) {});
throw DioException.sendTimeout(
timeout: sendTimeout,
requestOptions: options,
Expand All @@ -159,7 +159,7 @@ class Http2Adapter implements HttpClientAdapter {

final responseSink = StreamController<Uint8List>();
final responseHeaders = Headers();
final responseCompleter = Completer<void>();
final responseCompleter = Completer();
late StreamSubscription responseSubscription;
bool needRedirect = false;
bool needResponse = false;
Expand Down Expand Up @@ -225,8 +225,10 @@ class Http2Adapter implements HttpClientAdapter {
responseFuture = responseFuture.timeout(
receiveTimeout,
onTimeout: () async {
await responseSubscription.cancel().catchError((_) {});
await responseSink.close().catchError((_) {});
responseSubscription
.cancel()
.catchError((_) {})
.whenComplete(() => responseSink.close().catchError((_) {}));
throw DioException.receiveTimeout(
timeout: receiveTimeout,
requestOptions: options,
Expand Down

0 comments on commit 6b26185

Please sign in to comment.