| 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 return _RawServerSocket.bind(address, port, backlog, v6Only); | 10 return _RawServerSocket.bind(address, port, backlog, v6Only); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 socket.address = address; | 411 socket.address = address; |
| 412 var result = socket.nativeCreateConnect(address._in_addr, port); | 412 var result = socket.nativeCreateConnect(address._in_addr, port); |
| 413 if (result is OSError) { | 413 if (result is OSError) { |
| 414 // Keep first error, if present. | 414 // Keep first error, if present. |
| 415 if (error == null) { | 415 if (error == null) { |
| 416 error = createError(result, "Connection failed", address, port); | 416 error = createError(result, "Connection failed", address, port); |
| 417 } | 417 } |
| 418 connectNext(); | 418 connectNext(); |
| 419 } else { | 419 } else { |
| 420 socket.port; // Query the local port, for error messages. | 420 socket.port; // Query the local port, for error messages. |
| 421 // Set up timer for when we should retry the next address (if any)
. | 421 // Set up timer for when we should retry the next address |
| 422 // (if any). |
| 422 var duration = address.isLoopback ? | 423 var duration = address.isLoopback ? |
| 423 _RETRY_DURATION_LOOPBACK : | 424 _RETRY_DURATION_LOOPBACK : |
| 424 _RETRY_DURATION; | 425 _RETRY_DURATION; |
| 425 var timer = new Timer(duration, connectNext); | 426 var timer = new Timer(duration, connectNext); |
| 426 connecting[socket] = timer; | 427 connecting[socket] = timer; |
| 427 // Setup handlers for receiving the first write event which | 428 // Setup handlers for receiving the first write event which |
| 428 // indicate that the socket is fully connected. | 429 // indicate that the socket is fully connected. |
| 429 socket.setHandlers( | 430 socket.setHandlers( |
| 430 write: () { | 431 write: () { |
| 431 timer.cancel(); | 432 timer.cancel(); |
| (...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1928 String address, | 1929 String address, |
| 1929 List<int> in_addr, | 1930 List<int> in_addr, |
| 1930 int port) { | 1931 int port) { |
| 1931 return new Datagram( | 1932 return new Datagram( |
| 1932 data, | 1933 data, |
| 1933 new _InternetAddress(address, null, in_addr), | 1934 new _InternetAddress(address, null, in_addr), |
| 1934 port); | 1935 port); |
| 1935 } | 1936 } |
| 1936 | 1937 |
| 1937 String _socketsStats() => _SocketsObservatory.toJSON(); | 1938 String _socketsStats() => _SocketsObservatory.toJSON(); |
| OLD | NEW |