OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 5 |
6 class _SocketBase extends NativeFieldWrapperClass1 { | 6 class _SocketBase extends NativeFieldWrapperClass1 { |
7 // Bit flags used when communicating between the eventhandler and | 7 // Bit flags used when communicating between the eventhandler and |
8 // dart code. The EVENT flags are used to indicate events of | 8 // dart code. The EVENT flags are used to indicate events of |
9 // interest when sending a message from dart code to the | 9 // interest when sending a message from dart code to the |
10 // eventhandler. When receiving a message from the eventhandler the | 10 // eventhandler. When receiving a message from the eventhandler the |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 // For all errors we close the socket, call the error handler and | 202 // For all errors we close the socket, call the error handler and |
203 // disable further calls of the error handler. | 203 // disable further calls of the error handler. |
204 close(); | 204 close(); |
205 if (error is OSError) { | 205 if (error is OSError) { |
206 doReportError(new SocketIOException(message, error)); | 206 doReportError(new SocketIOException(message, error)); |
207 } else if (error is List) { | 207 } else if (error is List) { |
208 assert(_isErrorResponse(error)); | 208 assert(_isErrorResponse(error)); |
209 switch (error[0]) { | 209 switch (error[0]) { |
210 case _FileUtils.ILLEGAL_ARGUMENT_RESPONSE: | 210 case _FileUtils.ILLEGAL_ARGUMENT_RESPONSE: |
211 doReportError(new IllegalArgumentException()); | 211 doReportError(new ArgumentError()); |
212 break; | 212 break; |
213 case _FileUtils.OSERROR_RESPONSE: | 213 case _FileUtils.OSERROR_RESPONSE: |
214 doReportError(new SocketIOException( | 214 doReportError(new SocketIOException( |
215 message, new OSError(error[2], error[1]))); | 215 message, new OSError(error[2], error[1]))); |
216 break; | 216 break; |
217 default: | 217 default: |
218 doReportError(new Exception("Unknown error")); | 218 doReportError(new Exception("Unknown error")); |
219 break; | 219 break; |
220 } | 220 } |
221 } else { | 221 } else { |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 bool _seenFirstOutEvent = false; | 587 bool _seenFirstOutEvent = false; |
588 bool _pipe = false; | 588 bool _pipe = false; |
589 Function _clientConnectHandler; | 589 Function _clientConnectHandler; |
590 Function _clientWriteHandler; | 590 Function _clientWriteHandler; |
591 SocketInputStream _inputStream; | 591 SocketInputStream _inputStream; |
592 SocketOutputStream _outputStream; | 592 SocketOutputStream _outputStream; |
593 String _remoteHost; | 593 String _remoteHost; |
594 int _remotePort; | 594 int _remotePort; |
595 static SendPort _socketService; | 595 static SendPort _socketService; |
596 } | 596 } |
OLD | NEW |