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

Side by Side Diff: runtime/bin/socket_patch.dart

Issue 2426413006: Propagate errors correctly in Socket.connect (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 @patch class RawServerSocket { 5 @patch class RawServerSocket {
6 @patch static Future<RawServerSocket> bind(address, 6 @patch static Future<RawServerSocket> bind(address,
7 int port, 7 int port,
8 {int backlog: 0, 8 {int backlog: 0,
9 bool v6Only: false, 9 bool v6Only: false,
10 bool shared: false}) { 10 bool shared: false}) {
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 if (errorCode != null && socket.isBindError(errorCode)) { 442 if (errorCode != null && socket.isBindError(errorCode)) {
443 error = createError(result, "Bind failed", sourceAddress); 443 error = createError(result, "Bind failed", sourceAddress);
444 } else { 444 } else {
445 error = 445 error =
446 createError(result, "Connection failed", address, port); 446 createError(result, "Connection failed", address, port);
447 } 447 }
448 } 448 }
449 connectNext(); 449 connectNext();
450 } else { 450 } else {
451 // Query the local port, for error messages. 451 // Query the local port, for error messages.
452 socket.port; 452 try {
453 socket.port;
454 } catch (e) {
455 error = createError(e, "Connection failed", address, port);
456 connectNext();
457 }
453 // Set up timer for when we should retry the next address 458 // Set up timer for when we should retry the next address
454 // (if any). 459 // (if any).
455 var duration = address.isLoopback ? 460 var duration = address.isLoopback ?
456 _RETRY_DURATION_LOOPBACK : 461 _RETRY_DURATION_LOOPBACK :
457 _RETRY_DURATION; 462 _RETRY_DURATION;
458 var timer = new Timer(duration, connectNext); 463 var timer = new Timer(duration, connectNext);
459 setupResourceInfo(socket); 464 setupResourceInfo(socket);
460 465
461 connecting[socket] = timer; 466 connecting[socket] = timer;
462 // Setup handlers for receiving the first write event which 467 // Setup handlers for receiving the first write event which
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 Datagram _makeDatagram(List<int> data, 1877 Datagram _makeDatagram(List<int> data,
1873 String address, 1878 String address,
1874 List<int> in_addr, 1879 List<int> in_addr,
1875 int port) { 1880 int port) {
1876 return new Datagram( 1881 return new Datagram(
1877 data, 1882 data,
1878 new _InternetAddress(address, null, in_addr), 1883 new _InternetAddress(address, null, in_addr),
1879 port); 1884 port);
1880 } 1885 }
1881 1886
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698