Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1619)

Unified Diff: tools/testing/dart/http_server.dart

Issue 11040040: Temporary fix to mac buildbot issue. We need to figure out why (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/http_server.dart
diff --git a/tools/testing/dart/http_server.dart b/tools/testing/dart/http_server.dart
index d70da115d58b060005f0969286e37414f6246b44..820f07ba16a733b6a18a429e7152005b3c9cc93e 100644
--- a/tools/testing/dart/http_server.dart
+++ b/tools/testing/dart/http_server.dart
@@ -5,11 +5,16 @@
#library('http_server');
#import('dart:io');
+#import('dart:isolate');
#import('test_suite.dart'); // For TestUtils.
HttpServer _httpServer;
-startHttpServer(String host, int port) {
+// TODO(ager): Get rid of this when we get the Mac to behave.
+int _retries = 10;
+
+Future<bool> startHttpServer(String host, int port) {
+ var completer = new Completer();
var basePath = TestUtils.dartDir();
_httpServer = new HttpServer();
_httpServer.onError = (e) {
@@ -40,7 +45,22 @@ startHttpServer(String host, int port) {
});
}
};
- _httpServer.listen(host, port);
+
+ // TODO(ager): Get rid of this when we get the mac to behave.
+ // Even though we have set the SO_REUSEADDR the mac is not
+ // happy and gives us address alread in use errors.
+ try {
+ _httpServer.listen(host, port);
+ completer.complete(true);
+ } catch (e) {
+ if (_retries-- == 0) {
+ completer.completeException(e);
+ }
+ new Timer(1000, (t) {
+ startHttpServer(host, port).then((r) => completer.complete(r));
+ });
+ }
+ return completer.future;
}
terminateHttpServer() {
« no previous file with comments | « tools/test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698