Avoid using future closure in http connect.
Going through the closure seems to add 100+ms to the connect flow.
Change-Id: I3ba413a333a403628cb9d8320c91448c3ac7072c
Reviewed-on: https://dart-review.googlesource.com/c/80524
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
diff --git a/sdk/lib/_http/http_impl.dart b/sdk/lib/_http/http_impl.dart
index 983a4fb..018a8ea 100644
--- a/sdk/lib/_http/http_impl.dart
+++ b/sdk/lib/_http/http_impl.dart
@@ -2235,12 +2235,7 @@
.catchError(connect);
}
- // Make sure we go through the event loop before taking a
- // connection from the pool. For long-running synchronous code the
- // server might have closed the connection, so this lowers the
- // probability of getting a connection that was already closed.
- return new Future<_ConnectionInfo>(
- () => connect(new HttpException("No proxies given")));
+ return connect(new HttpException("No proxies given"));
}
_SiteCredentials _findCredentials(Uri url, [_AuthenticationScheme scheme]) {