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

Unified Diff: sdk/lib/io/secure_socket.dart

Issue 169383003: Make event-handlers edge-triggered and move socket-state to Dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/secure_socket.dart
diff --git a/sdk/lib/io/secure_socket.dart b/sdk/lib/io/secure_socket.dart
index b3c70636f8d4c1ae9138e54e91d8194c2b57df10..241da82cbbbede6f58e2dec65357b9bab9418de6 100644
--- a/sdk/lib/io/secure_socket.dart
+++ b/sdk/lib/io/secure_socket.dart
@@ -973,7 +973,8 @@ class _RawSecureSocket extends Stream<RawSocketEvent>
_sendReadEvent() {
_pendingReadEvent = false;
- if (_readEventsEnabled &&
+ if (_status != CLOSED &&
+ _readEventsEnabled &&
_pauseCount == 0 &&
_secureFilter != null &&
!_secureFilter.buffers[READ_PLAINTEXT].isEmpty) {
@@ -1164,16 +1165,16 @@ class _ExternalBuffer {
int written = 0;
int toWrite = linearFree;
// Loop over zero, one, or two linear data ranges.
- while (toWrite > 0) {
+ do {
// Source returns at most toWrite bytes, and it returns null when empty.
var inputData = getData(toWrite);
- if (inputData == null) break;
+ if (inputData == null || inputData.length == 0) break;
var len = inputData.length;
data.setRange(end, end + len, inputData);
advanceEnd(len);
written += len;
toWrite = linearFree;
- }
+ } while (toWrite > 0);
return written;
}
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698