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

Unified Diff: runtime/bin/tls_socket.dart

Issue 10704159: Start adding TLS (SSL) sockets to dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add proper event handling during handshake phase of connection. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/tls_socket.dart
diff --git a/runtime/bin/socket.dart b/runtime/bin/tls_socket.dart
similarity index 62%
copy from runtime/bin/socket.dart
copy to runtime/bin/tls_socket.dart
index e26694d0b5ea03deaf0acdddea08efbabaf1a959..78d818942ae9e5ebaa7d7c5fe376a1f8d08378f2 100644
--- a/runtime/bin/socket.dart
+++ b/runtime/bin/tls_socket.dart
@@ -2,43 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-interface ServerSocket default _ServerSocket {
- /**
- * Constructs a new server socket, binds it to a given address and port,
- * and listens on it.
- */
- ServerSocket(String bindAddress, int port, int backlog);
-
- /**
- * The connection handler gets called when there is a new incoming
- * connection on the socket.
- */
- void set onConnection(void callback(Socket connection));
-
- /**
- * The error handler gets called when a socket error occurs.
- */
- void set onError(void callback(e));
-
- /**
- * Returns the port used by this socket.
- */
- int get port();
-
- /**
- * Closes the socket.
- */
- void close();
-}
-
-
-interface Socket extends Hashable default _Socket {
+interface TlsSocket extends Socket, Hashable default _TlsSocket {
/**
* Constructs a new socket and initiate connecting it to the given
* host on the given port. The returned socket is not yet connected
* but ready for registration of callbacks.
*/
- Socket(String host, int port);
+ TlsSocket(String host, int port);
/**
* Returns the number of received and non-read bytes in the socket that
@@ -74,10 +44,8 @@ interface Socket extends Hashable default _Socket {
void set onData(void callback());
/**
- * The write handler gets called once when the socket becomes
- * available for writing. Then the handler is automatically reset to null.
- * This handler is mainly used when writeList has reported an incomplete
- * write, to schedule writing the remaining data to the socket.
+ * The write handler gets called when the socket becomes available for
Anders Johnsen 2012/07/27 15:58:49 The logic should be the same as for any other Sock
Bill Hesse 2012/08/08 17:00:05 All of this code is removed. On 2012/07/27 15:58:
+ * writing.
*/
void set onWrite(void callback());
@@ -125,31 +93,10 @@ interface Socket extends Hashable default _Socket {
* possible to read data. Calling [close] will not trigger a call to
* [onClosed].
*/
- void close([bool halfClose]);
+ void close([bool halfClose = false]);
Anders Johnsen 2012/07/27 15:58:49 Should not be here.
Bill Hesse 2012/08/08 17:00:05 Done.
/**
* Socket is hashable.
*/
int hashCode();
}
-
-
-class SocketIOException implements Exception {
- const SocketIOException([String this.message = "",
- OSError this.osError = null]);
- String toString() {
- StringBuffer sb = new StringBuffer();
- sb.add("SocketIOException");
- if (!message.isEmpty()) {
- sb.add(": $message");
- if (osError != null) {
- sb.add(" ($osError)");
- }
- } else if (osError != null) {
- sb.add(": $osError");
- }
- return sb.toString();
- }
- final String message;
- final OSError osError;
-}

Powered by Google App Engine
This is Rietveld 408576698