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

Side by Side Diff: runtime/bin/socket_patch.dart

Issue 21802002: Fix a Socket edge-case where the socket is closed by peer right after accept, where we havn't set a… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | no next file » | 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 patch class RawServerSocket { 5 patch class RawServerSocket {
6 /* patch */ static Future<RawServerSocket> bind(address, 6 /* patch */ static Future<RawServerSocket> bind(address,
7 int port, 7 int port,
8 {int backlog: 0, 8 {int backlog: 0,
9 bool v6Only: false}) { 9 bool v6Only: false}) {
10 return _RawServerSocket.bind(address, port, backlog, v6Only); 10 return _RawServerSocket.bind(address, port, backlog, v6Only);
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // Don't call the in handler if there is no data available 483 // Don't call the in handler if there is no data available
484 // after all. 484 // after all.
485 if (i == READ_EVENT && 485 if (i == READ_EVENT &&
486 typeFlags != TYPE_LISTENING_SOCKET && 486 typeFlags != TYPE_LISTENING_SOCKET &&
487 available() == 0) { 487 available() == 0) {
488 continue; 488 continue;
489 } 489 }
490 if (i == ERROR_EVENT) { 490 if (i == ERROR_EVENT) {
491 reportError(nativeGetError(), ""); 491 reportError(nativeGetError(), "");
492 } else if (!isClosed) { 492 } else if (!isClosed) {
493 handler(); 493 // If the connection is closed right after it's accepted, there's a
494 // chance the close-handler is not set.
495 if (handler != null) handler();
494 } 496 }
495 } 497 }
496 } 498 }
497 if (isClosedRead && isClosedWrite) close(); 499 if (isClosedRead && isClosedWrite) close();
498 canActivateEvents = true; 500 canActivateEvents = true;
499 activateHandlers(); 501 activateHandlers();
500 } 502 }
501 503
502 void setHandlers({read, write, error, closed, destroyed}) { 504 void setHandlers({read, write, error, closed, destroyed}) {
503 eventHandlers[READ_EVENT] = read; 505 eventHandlers[READ_EVENT] = read;
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 if (_detachReady != null) { 1220 if (_detachReady != null) {
1219 _detachReady.complete(null); 1221 _detachReady.complete(null);
1220 } else { 1222 } else {
1221 if (_raw != null) { 1223 if (_raw != null) {
1222 _raw.shutdown(SocketDirection.SEND); 1224 _raw.shutdown(SocketDirection.SEND);
1223 _disableWriteEvent(); 1225 _disableWriteEvent();
1224 } 1226 }
1225 } 1227 }
1226 } 1228 }
1227 } 1229 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698