| 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([String address = "127.0.0.1", | 6 /* patch */ static Future<RawServerSocket> bind([String address = "127.0.0.1", |
| 7 int port = 0, | 7 int port = 0, |
| 8 int backlog = 0]) { | 8 int backlog = 0]) { |
| 9 return _RawServerSocket.bind(address, port, backlog); | 9 return _RawServerSocket.bind(address, port, backlog); |
| 10 } | 10 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 }); | 108 }); |
| 109 return completer.future; | 109 return completer.future; |
| 110 } | 110 } |
| 111 | 111 |
| 112 static Future<_NativeSocket> bind(String address, | 112 static Future<_NativeSocket> bind(String address, |
| 113 int port, | 113 int port, |
| 114 int backlog) { | 114 int backlog) { |
| 115 var socket = new _NativeSocket.listen(); | 115 var socket = new _NativeSocket.listen(); |
| 116 var result = socket.nativeCreateBindListen(address, port, backlog); | 116 var result = socket.nativeCreateBindListen(address, port, backlog); |
| 117 if (result is OSError) { | 117 if (result is OSError) { |
| 118 return new Future.immediateError( | 118 return new Future.error( |
| 119 new SocketIOException("Failed to create server socket", result)); | 119 new SocketIOException("Failed to create server socket", result)); |
| 120 } | 120 } |
| 121 if (port != 0) socket.localPort = port; | 121 if (port != 0) socket.localPort = port; |
| 122 return new Future.immediate(socket); | 122 return new Future.value(socket); |
| 123 } | 123 } |
| 124 | 124 |
| 125 _NativeSocket.normal() : typeFlags = TYPE_NORMAL_SOCKET { | 125 _NativeSocket.normal() : typeFlags = TYPE_NORMAL_SOCKET { |
| 126 eventHandlers = new List(EVENT_COUNT + 1); | 126 eventHandlers = new List(EVENT_COUNT + 1); |
| 127 _EventHandler._start(); | 127 _EventHandler._start(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 _NativeSocket.listen() : typeFlags = TYPE_LISTENING_SOCKET { | 130 _NativeSocket.listen() : typeFlags = TYPE_LISTENING_SOCKET { |
| 131 eventHandlers = new List(EVENT_COUNT + 1); | 131 eventHandlers = new List(EVENT_COUNT + 1); |
| 132 _EventHandler._start(); | 132 _EventHandler._start(); |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 _raw.onBadCertificate = callback; | 973 _raw.onBadCertificate = callback; |
| 974 } | 974 } |
| 975 | 975 |
| 976 X509Certificate get peerCertificate { | 976 X509Certificate get peerCertificate { |
| 977 if (_raw == null) { | 977 if (_raw == null) { |
| 978 throw new StateError("peerCertificate called on destroyed SecureSocket"); | 978 throw new StateError("peerCertificate called on destroyed SecureSocket"); |
| 979 } | 979 } |
| 980 return _raw.peerCertificate; | 980 return _raw.peerCertificate; |
| 981 } | 981 } |
| 982 } | 982 } |
| OLD | NEW |