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

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

Issue 14864009: Keep track of when a socket has been destroyed (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove delete_handle marker. Created 7 years, 5 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/http_impl.dart ('k') | tests/standalone/io/raw_socket_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 part of dart.io; 5 part of dart.io;
6 6
7 7
8 /** 8 /**
9 * [InternetAddressType] is the type an [InternetAddress]. Currently, 9 * [InternetAddressType] is the type an [InternetAddress]. Currently,
10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported. 10 * IP version 4 (IPv4) and IP version 6 (IPv6) are supported.
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 int port, 250 int port,
251 {int backlog: 0, 251 {int backlog: 0,
252 bool v6Only: false}); 252 bool v6Only: false});
253 253
254 /** 254 /**
255 * Returns the port used by this socket. 255 * Returns the port used by this socket.
256 */ 256 */
257 int get port; 257 int get port;
258 258
259 /** 259 /**
260 * Closes the socket. 260 * Closes the socket. The returned future completes when the socket
261 * is fully closed and is no longer bound.
261 */ 262 */
262 void close(); 263 Future close();
263 } 264 }
264 265
265 /** 266 /**
266 * The [SocketDirection] is used as a parameter to [Socket.close] and 267 * The [SocketDirection] is used as a parameter to [Socket.close] and
267 * [RawSocket.close] to close a socket in the specified direction(s). 268 * [RawSocket.close] to close a socket in the specified direction(s).
268 */ 269 */
269 class SocketDirection { 270 class SocketDirection {
270 static const SocketDirection RECEIVE = const SocketDirection._(0); 271 static const SocketDirection RECEIVE = const SocketDirection._(0);
271 static const SocketDirection SEND = const SocketDirection._(1); 272 static const SocketDirection SEND = const SocketDirection._(1);
272 static const SocketDirection BOTH = const SocketDirection._(2); 273 static const SocketDirection BOTH = const SocketDirection._(2);
(...skipping 20 matching lines...) Expand all
293 final _value; 294 final _value;
294 } 295 }
295 296
296 /** 297 /**
297 * Events for the [RawSocket]. 298 * Events for the [RawSocket].
298 */ 299 */
299 class RawSocketEvent { 300 class RawSocketEvent {
300 static const RawSocketEvent READ = const RawSocketEvent._(0); 301 static const RawSocketEvent READ = const RawSocketEvent._(0);
301 static const RawSocketEvent WRITE = const RawSocketEvent._(1); 302 static const RawSocketEvent WRITE = const RawSocketEvent._(1);
302 static const RawSocketEvent READ_CLOSED = const RawSocketEvent._(2); 303 static const RawSocketEvent READ_CLOSED = const RawSocketEvent._(2);
304 static const RawSocketEvent CLOSED = const RawSocketEvent._(3);
303 const RawSocketEvent._(this._value); 305 const RawSocketEvent._(this._value);
304 final int _value; 306 final int _value;
305 String toString() { 307 String toString() {
306 return ['RawSocketEvent:READ', 308 return ['RawSocketEvent:READ',
307 'RawSocketEvent:WRITE', 309 'RawSocketEvent:WRITE',
308 'RawSocketEvent:READ_CLOSED'][_value]; 310 'RawSocketEvent:READ_CLOSED',
311 'RawSocketEvent:CLOSED'][_value];
309 } 312 }
310 } 313 }
311 314
312 /** 315 /**
313 * The [RawSocket] is a low-level interface to a socket, exposing the raw 316 * The [RawSocket] is a low-level interface to a socket, exposing the raw
314 * events signaled by the system. It's a [Stream] of [RawSocketEvent]s. 317 * events signaled by the system. It's a [Stream] of [RawSocketEvent]s.
315 */ 318 */
316 abstract class RawSocket implements Stream<RawSocketEvent> { 319 abstract class RawSocket implements Stream<RawSocketEvent> {
317 /** 320 /**
318 * Creates a new socket connection to the host and port and returns a [Future] 321 * Creates a new socket connection to the host and port and returns a [Future]
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 } else { 497 } else {
495 sb.write(", address = ${address.address}"); 498 sb.write(", address = ${address.address}");
496 } 499 }
497 } 500 }
498 if (port != null) { 501 if (port != null) {
499 sb.write(", port = $port"); 502 sb.write(", port = $port");
500 } 503 }
501 return sb.toString(); 504 return sb.toString();
502 } 505 }
503 } 506 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/raw_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698