| 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 { | 6 class _SocketBase { |
| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 }); | 340 }); |
| 341 return socket; | 341 return socket; |
| 342 } | 342 } |
| 343 | 343 |
| 344 _Socket._internal(); | 344 _Socket._internal(); |
| 345 _Socket._internalReadOnly() : _pipe = true { super._closedWrite = true; } | 345 _Socket._internalReadOnly() : _pipe = true { super._closedWrite = true; } |
| 346 _Socket._internalWriteOnly() : _pipe = true { super._closedRead = true; } | 346 _Socket._internalWriteOnly() : _pipe = true { super._closedRead = true; } |
| 347 | 347 |
| 348 int available() { | 348 int available() { |
| 349 if (_id >= 0) { | 349 if (_id >= 0) { |
| 350 return _available(); | 350 var result = _available(); |
| 351 if (result is OSError) { |
| 352 _reportError(result, "Available failed"); |
| 353 return 0; |
| 354 } else { |
| 355 return result; |
| 356 } |
| 351 } | 357 } |
| 352 throw new | 358 throw new |
| 353 SocketIOException("Error: available failed - invalid socket handle"); | 359 SocketIOException("Error: available failed - invalid socket handle"); |
| 354 } | 360 } |
| 355 | 361 |
| 356 int _available() native "Socket_Available"; | 362 _available() native "Socket_Available"; |
| 357 | 363 |
| 358 int readList(List<int> buffer, int offset, int bytes) { | 364 int readList(List<int> buffer, int offset, int bytes) { |
| 359 if (_id >= 0) { | 365 if (_id >= 0) { |
| 360 if (bytes == 0) { | 366 if (bytes == 0) { |
| 361 return 0; | 367 return 0; |
| 362 } | 368 } |
| 363 if (offset < 0) { | 369 if (offset < 0) { |
| 364 throw new IndexOutOfRangeException(offset); | 370 throw new IndexOutOfRangeException(offset); |
| 365 } | 371 } |
| 366 if (bytes < 0) { | 372 if (bytes < 0) { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 bool _seenFirstOutEvent = false; | 584 bool _seenFirstOutEvent = false; |
| 579 bool _pipe = false; | 585 bool _pipe = false; |
| 580 Function _clientConnectHandler; | 586 Function _clientConnectHandler; |
| 581 Function _clientWriteHandler; | 587 Function _clientWriteHandler; |
| 582 SocketInputStream _inputStream; | 588 SocketInputStream _inputStream; |
| 583 SocketOutputStream _outputStream; | 589 SocketOutputStream _outputStream; |
| 584 String _remoteHost; | 590 String _remoteHost; |
| 585 int _remotePort; | 591 int _remotePort; |
| 586 static SendPort _socketService; | 592 static SendPort _socketService; |
| 587 } | 593 } |
| OLD | NEW |