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

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

Issue 204343003: Close(destroy) Socket on user-generated write error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « no previous file | tests/standalone/io/socket_invalid_arguments_test.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) 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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 if (socket._raw != null) { 1338 if (socket._raw != null) {
1339 subscription = stream.listen( 1339 subscription = stream.listen(
1340 (data) { 1340 (data) {
1341 assert(!paused); 1341 assert(!paused);
1342 assert(buffer == null); 1342 assert(buffer == null);
1343 buffer = data; 1343 buffer = data;
1344 offset = 0; 1344 offset = 0;
1345 try { 1345 try {
1346 write(); 1346 write();
1347 } catch (e) { 1347 } catch (e) {
1348 socket.destroy();
1348 stop(); 1349 stop();
1349 socket._consumerDone();
1350 done(e); 1350 done(e);
1351 } 1351 }
1352 }, 1352 },
1353 onError: (error, [stackTrace]) { 1353 onError: (error, [stackTrace]) {
1354 socket._consumerDone(); 1354 socket.destroy();
1355 done(error, stackTrace); 1355 done(error, stackTrace);
1356 }, 1356 },
1357 onDone: () { 1357 onDone: () {
1358 done(); 1358 done();
1359 }, 1359 },
1360 cancelOnError: true); 1360 cancelOnError: true);
1361 } 1361 }
1362 return streamCompleter.future; 1362 return streamCompleter.future;
1363 } 1363 }
1364 1364
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 String address, 1754 String address,
1755 List<int> in_addr, 1755 List<int> in_addr,
1756 int port) { 1756 int port) {
1757 return new Datagram( 1757 return new Datagram(
1758 data, 1758 data,
1759 new _InternetAddress(address, null, in_addr), 1759 new _InternetAddress(address, null, in_addr),
1760 port); 1760 port);
1761 } 1761 }
1762 1762
1763 String _socketsStats() => _SocketsObservatory.toJSON(); 1763 String _socketsStats() => _SocketsObservatory.toJSON();
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/socket_invalid_arguments_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698