Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: sdk/lib/io/secure_socket.dart

Issue 12610006: Renamed StreamSink to EventSink. Renamed signalError to addError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed inheritance back! Now create StreamSink instead of EventSink where we create them. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * A high-level class for communicating securely over a TCP socket, using 8 * A high-level class for communicating securely over a TCP socket, using
9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an 9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an
10 * [IOSink] interface, making it ideal for using together with 10 * [IOSink] interface, making it ideal for using together with
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 457 }
458 458
459 return result; 459 return result;
460 } 460 }
461 461
462 // Write the data to the socket, and flush it as much as possible 462 // Write the data to the socket, and flush it as much as possible
463 // until it would block. If the write would block, _writeEncryptedData sets 463 // until it would block. If the write would block, _writeEncryptedData sets
464 // up handlers to flush the pipeline when possible. 464 // up handlers to flush the pipeline when possible.
465 int write(List<int> data, [int offset, int bytes]) { 465 int write(List<int> data, [int offset, int bytes]) {
466 if (_closedWrite) { 466 if (_closedWrite) {
467 _controller.signalError(new AsyncError(new SocketIOException( 467 _controller.addError(new AsyncError(new SocketIOException(
468 "Writing to a closed socket"))); 468 "Writing to a closed socket")));
469 return 0; 469 return 0;
470 } 470 }
471 if (_status != CONNECTED) return 0; 471 if (_status != CONNECTED) return 0;
472 var buffer = _secureFilter.buffers[WRITE_PLAINTEXT]; 472 var buffer = _secureFilter.buffers[WRITE_PLAINTEXT];
473 if (bytes > buffer.free) { 473 if (bytes > buffer.free) {
474 bytes = buffer.free; 474 bytes = buffer.free;
475 } 475 }
476 if (bytes > 0) { 476 if (bytes > 0) {
477 buffer.data.setRange(buffer.start + buffer.length, bytes, data, offset); 477 buffer.data.setRange(buffer.start + buffer.length, bytes, data, offset);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 } else if (error is SocketIOException) { 565 } else if (error is SocketIOException) {
566 e = new SocketIOException('$message (${error.message})', error.osError); 566 e = new SocketIOException('$message (${error.message})', error.osError);
567 } else if (error is OSError) { 567 } else if (error is OSError) {
568 e = new SocketIOException(message, error); 568 e = new SocketIOException(message, error);
569 } else { 569 } else {
570 e = new SocketIOException('$message (${error.toString()})', null); 570 e = new SocketIOException('$message (${error.toString()})', null);
571 } 571 }
572 if (_connectPending) { 572 if (_connectPending) {
573 _handshakeComplete.completeError(e); 573 _handshakeComplete.completeError(e);
574 } else { 574 } else {
575 _controller.signalError(e); 575 _controller.addError(e);
576 } 576 }
577 _close(); 577 _close();
578 } 578 }
579 579
580 void _closeHandler() { 580 void _closeHandler() {
581 if (_status == CONNECTED) { 581 if (_status == CONNECTED) {
582 if (_closedRead) return; 582 if (_closedRead) return;
583 _socketClosedRead = true; 583 _socketClosedRead = true;
584 if (_filterReadEmpty) { 584 if (_filterReadEmpty) {
585 _closedRead = true; 585 _closedRead = true;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 void destroy(); 748 void destroy();
749 void handshake(); 749 void handshake();
750 void init(); 750 void init();
751 X509Certificate get peerCertificate; 751 X509Certificate get peerCertificate;
752 int processBuffer(int bufferIndex); 752 int processBuffer(int bufferIndex);
753 void registerBadCertificateCallback(Function callback); 753 void registerBadCertificateCallback(Function callback);
754 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); 754 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler);
755 755
756 List<_ExternalBuffer> get buffers; 756 List<_ExternalBuffer> get buffers;
757 } 757 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698