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

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

Issue 12320088: dart:io: Prevent initial WRITE event on RawSecureSocket when writeEventsEnabled is set to false. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if (_socketClosedWrite) { 379 if (_socketClosedWrite) {
380 close(); 380 close();
381 } 381 }
382 } 382 }
383 } 383 }
384 384
385 bool get writeEventsEnabled => _writeEventsEnabled; 385 bool get writeEventsEnabled => _writeEventsEnabled;
386 386
387 void set writeEventsEnabled(bool value) { 387 void set writeEventsEnabled(bool value) {
388 if (value && 388 if (value &&
389 _controller.hasSubscribers &&
Søren Gjesse 2013/02/25 07:20:44 What about paused?
Bill Hesse 2013/02/25 07:32:36 It should be legal to enqueue a WRITE event if the
Søren Gjesse 2013/02/25 14:50:54 I agree that it is not an error to send WRITE even
389 _secureFilter != null && 390 _secureFilter != null &&
390 _secureFilter.buffers[WRITE_PLAINTEXT].free > 0) { 391 _secureFilter.buffers[WRITE_PLAINTEXT].free > 0) {
391 new Timer(0, (_) => _controller.add(RawSocketEvent.WRITE)); 392 new Timer(0, (_) => _controller.add(RawSocketEvent.WRITE));
392 } else { 393 } else {
393 _writeEventsEnabled = value; 394 _writeEventsEnabled = value;
394 } 395 }
395 } 396 }
396 397
397 bool get readEventsEnabled => _readEventsEnabled; 398 bool get readEventsEnabled => _readEventsEnabled;
398 399
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 if (_filterWriteEmpty && _closedWrite && !_socketClosedWrite) { 483 if (_filterWriteEmpty && _closedWrite && !_socketClosedWrite) {
483 // Close _socket for write, by calling shutdown(), to avoid cloning the 484 // Close _socket for write, by calling shutdown(), to avoid cloning the
484 // socket closing code in shutdown(). 485 // socket closing code in shutdown().
485 shutdown(SocketDirection.SEND); 486 shutdown(SocketDirection.SEND);
486 } 487 }
487 if (_status == HANDSHAKE) { 488 if (_status == HANDSHAKE) {
488 try { 489 try {
489 _secureHandshake(); 490 _secureHandshake();
490 } catch (e) { _reportError(e, "RawSecureSocket error"); } 491 } catch (e) { _reportError(e, "RawSecureSocket error"); }
491 } else if (_status == CONNECTED && 492 } else if (_status == CONNECTED &&
493 _controller.hasSubscribers &&
Søren Gjesse 2013/02/25 07:20:44 Ditto.
492 _writeEventsEnabled && 494 _writeEventsEnabled &&
493 _secureFilter.buffers[WRITE_PLAINTEXT].free > 0) { 495 _secureFilter.buffers[WRITE_PLAINTEXT].free > 0) {
494 // Reset the one-shot handler. 496 // Reset the one-shot handler.
495 _writeEventsEnabled = false; 497 _writeEventsEnabled = false;
496 _controller.add(RawSocketEvent.WRITE); 498 _controller.add(RawSocketEvent.WRITE);
497 } 499 }
498 } 500 }
499 501
500 void _eventDispatcher(RawSocketEvent event) { 502 void _eventDispatcher(RawSocketEvent event) {
501 if (event == RawSocketEvent.READ) { 503 if (event == RawSocketEvent.READ) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 void destroy(); 742 void destroy();
741 void handshake(); 743 void handshake();
742 void init(); 744 void init();
743 X509Certificate get peerCertificate; 745 X509Certificate get peerCertificate;
744 int processBuffer(int bufferIndex); 746 int processBuffer(int bufferIndex);
745 void registerBadCertificateCallback(Function callback); 747 void registerBadCertificateCallback(Function callback);
746 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); 748 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler);
747 749
748 List<_ExternalBuffer> get buffers; 750 List<_ExternalBuffer> get buffers;
749 } 751 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698