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

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

Issue 12213092: Rework Timer interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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 | « sdk/lib/io/list_stream_impl.dart ('k') | sdk/lib/io/socket_stream_impl.dart » ('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) 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 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * SecureSocket provides a secure (SSL or TLS) client connection to a server. 8 * SecureSocket provides a secure (SSL or TLS) client connection to a server.
9 * The certificate provided by the server is checked 9 * The certificate provided by the server is checked
10 * using the certificate database (optionally) provided in initialize(). 10 * using the certificate database (optionally) provided in initialize().
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // If the filter is empty, then we are guaranteed an event when it 582 // If the filter is empty, then we are guaranteed an event when it
583 // becomes unblocked. Cancel any _secureDataHandler call. 583 // becomes unblocked. Cancel any _secureDataHandler call.
584 // Otherwise, schedule a _secureDataHandler call since there may data 584 // Otherwise, schedule a _secureDataHandler call since there may data
585 // available, and this read call enables the data event. 585 // available, and this read call enables the data event.
586 if (_filterReadEmpty) { 586 if (_filterReadEmpty) {
587 if (scheduledDataEvent != null) { 587 if (scheduledDataEvent != null) {
588 scheduledDataEvent.cancel(); 588 scheduledDataEvent.cancel();
589 scheduledDataEvent = null; 589 scheduledDataEvent = null;
590 } 590 }
591 } else if (scheduledDataEvent == null) { 591 } else if (scheduledDataEvent == null) {
592 scheduledDataEvent = new Timer(0, (_) => _secureDataHandler()); 592 scheduledDataEvent = Timer.run(_secureDataHandler);
593 } 593 }
594 594
595 if (_socketClosedRead) { // An onClose event is pending. 595 if (_socketClosedRead) { // An onClose event is pending.
596 // _closedRead is false, since we are in a read or readList call. 596 // _closedRead is false, since we are in a read or readList call.
597 if (!_filterReadEmpty) { 597 if (!_filterReadEmpty) {
598 // _filterReadEmpty may be out of date since read and readList empty 598 // _filterReadEmpty may be out of date since read and readList empty
599 // the plaintext buffer after calling _readEncryptedData. 599 // the plaintext buffer after calling _readEncryptedData.
600 // TODO(whesse): Fix this as part of fixing read and readList. 600 // TODO(whesse): Fix this as part of fixing read and readList.
601 _readEncryptedData(); 601 _readEncryptedData();
602 } 602 }
603 if (_filterReadEmpty) { 603 if (_filterReadEmpty) {
604 // This can't be an else clause: the value of _filterReadEmpty changes. 604 // This can't be an else clause: the value of _filterReadEmpty changes.
605 // This must be asynchronous, because we are in a read or readList call. 605 // This must be asynchronous, because we are in a read or readList call.
606 new Timer(0, (_) => _secureCloseHandler()); 606 Timer.run(_secureCloseHandler);
607 } 607 }
608 } 608 }
609 } 609 }
610 610
611 bool get _socketClosed => _closedRead; 611 bool get _socketClosed => _closedRead;
612 612
613 // _SecureSocket cannot extend _Socket and use _Socket's factory constructor. 613 // _SecureSocket cannot extend _Socket and use _Socket's factory constructor.
614 Socket socket; 614 Socket socket;
615 final String host; 615 final String host;
616 final bool is_server; 616 final bool is_server;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 void destroy(); 677 void destroy();
678 void handshake(); 678 void handshake();
679 void init(); 679 void init();
680 X509Certificate get peerCertificate; 680 X509Certificate get peerCertificate;
681 int processBuffer(int bufferIndex); 681 int processBuffer(int bufferIndex);
682 void registerBadCertificateCallback(Function callback); 682 void registerBadCertificateCallback(Function callback);
683 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); 683 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler);
684 684
685 List<_ExternalBuffer> get buffers; 685 List<_ExternalBuffer> get buffers;
686 } 686 }
OLDNEW
« no previous file with comments | « sdk/lib/io/list_stream_impl.dart ('k') | sdk/lib/io/socket_stream_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698