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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.immediateError( |
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.immediate(socket); |
123 } | 123 } |
124 | 124 |
125 _NativeSocket.normal() : typeFlags = TYPE_NORMAL_SOCKET { | 125 _NativeSocket.normal() : typeFlags = TYPE_NORMAL_SOCKET { |
126 eventHandlers = new List.fixedLength(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.fixedLength(EVENT_COUNT + 1); | 131 eventHandlers = new List(EVENT_COUNT + 1); |
132 _EventHandler._start(); | 132 _EventHandler._start(); |
133 } | 133 } |
134 | 134 |
135 _NativeSocket.pipe() : typeFlags = TYPE_PIPE { | 135 _NativeSocket.pipe() : typeFlags = TYPE_PIPE { |
136 eventHandlers = new List.fixedLength(EVENT_COUNT + 1); | 136 eventHandlers = new List(EVENT_COUNT + 1); |
137 _EventHandler._start(); | 137 _EventHandler._start(); |
138 } | 138 } |
139 | 139 |
140 int available() { | 140 int available() { |
141 if (isClosed) return 0; | 141 if (isClosed) return 0; |
142 var result = nativeAvailable(); | 142 var result = nativeAvailable(); |
143 if (result is OSError) { | 143 if (result is OSError) { |
144 reportError(result, "Available failed"); | 144 reportError(result, "Available failed"); |
145 return 0; | 145 return 0; |
146 } else { | 146 } else { |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 _raw.onBadCertificate = callback; | 916 _raw.onBadCertificate = callback; |
917 } | 917 } |
918 | 918 |
919 X509Certificate get peerCertificate { | 919 X509Certificate get peerCertificate { |
920 if (_raw == null) { | 920 if (_raw == null) { |
921 throw new StateError("peerCertificate called on destroyed SecureSocket"); | 921 throw new StateError("peerCertificate called on destroyed SecureSocket"); |
922 } | 922 } |
923 return _raw.peerCertificate; | 923 return _raw.peerCertificate; |
924 } | 924 } |
925 } | 925 } |
OLD | NEW |