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

Unified Diff: runtime/bin/socket_patch.dart

Issue 13502004: Add the ability to secure an already established raw socket connection (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed debug print Created 7 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 | sdk/lib/io/secure_socket.dart » ('j') | sdk/lib/io/secure_socket.dart » ('J')
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 0e9c25f9d499a5f95cd063c4ef5e39cbaa60103d..69d5ab48e36299731fc1bbe6f4f11a43b4d60936 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -74,6 +74,9 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
// Holds the port of the socket, null if not known.
int localPort;
+ // Holds the host or address used to connect or bind the socket.
+ String localHost;
+
// Native port for socket services.
static SendPort socketService;
@@ -86,6 +89,7 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
createError(response, "Failed host name lookup"));
} else {
var socket = new _NativeSocket.normal();
+ socket.localHost = host;
var result = socket.nativeCreateConnect(response, port);
if (result is OSError) {
completer.completeError(createError(result, "Connection failed"));
@@ -113,6 +117,7 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
int port,
int backlog) {
var socket = new _NativeSocket.listen();
+ socket.localHost = address;
var result = socket.nativeCreateBindListen(address, port, backlog);
if (result is OSError) {
return new Future.immediateError(
@@ -201,6 +206,8 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
return nativeGetRemotePeer()[1];
}
+ String get host => localHost;
+
String get remoteHost {
return nativeGetRemotePeer()[0];
}
@@ -560,6 +567,8 @@ class _RawSocket extends Stream<RawSocketEvent>
int get remotePort => _socket.remotePort;
+ String get host => _socket.host;
+
String get remoteHost => _socket.remoteHost;
bool get readEventsEnabled => _readEventsEnabled;
@@ -601,7 +610,7 @@ class _RawSocket extends Stream<RawSocketEvent>
if (_controller.hasSubscribers) {
_resume();
} else {
- close();
+ _pause();
Mads Ager (google) 2013/04/03 15:26:55 So, this means that listening on a socket and canc
Søren Gjesse 2013/04/19 05:17:09 After discussing this with Florian I reverted, and
}
}
}
« no previous file with comments | « no previous file | sdk/lib/io/secure_socket.dart » ('j') | sdk/lib/io/secure_socket.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698