| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |