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

Unified Diff: runtime/bin/socket_patch.dart

Issue 985533003: Make Socket address and port getters available after the socket is closed (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/io/raw_socket_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_patch.dart
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index fb471e61d6a7b4ecf714c7595a1db7aa777564d8..94285aaaa02ed59b6eb0905770a60a066762bdf3 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -433,7 +433,8 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
}
connectNext();
} else {
- socket.port; // Query the local port, for error messages.
+ // Query the local port, for error messages.
+ socket.port;
// Set up timer for when we should retry the next address
// (if any).
var duration = address.isLoopback ?
@@ -678,8 +679,8 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
}
int get port {
- if (isClosing || isClosed) throw const SocketException.closed();
if (localPort != 0) return localPort;
+ if (isClosing || isClosed) throw const SocketException.closed();
var result = nativeGetPort();
if (result is OSError) throw result;
return localPort = result;
@@ -692,10 +693,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
return result[1];
}
- InternetAddress get address {
- if (isClosing || isClosed) throw const SocketException.closed();
- return localAddress;
- }
+ InternetAddress get address => localAddress;
InternetAddress get remoteAddress {
if (isClosing || isClosed) throw const SocketException.closed();
« no previous file with comments | « no previous file | tests/standalone/io/raw_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698