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

Unified Diff: runtime/bin/eventhandler_win.h

Issue 264613002: Use ConnectEx on Windows, to do async connect of sockets. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | runtime/bin/eventhandler_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_win.h
diff --git a/runtime/bin/eventhandler_win.h b/runtime/bin/eventhandler_win.h
index 90e505add21567a0b69064b1bae846aa37727baa..89b194131d0d3dc29c1d8009cda0d3c4d3fd204f 100644
--- a/runtime/bin/eventhandler_win.h
+++ b/runtime/bin/eventhandler_win.h
@@ -41,7 +41,9 @@ struct InterruptMessage {
// socket for the client.
class OverlappedBuffer {
public:
- enum Operation { kAccept, kRead, kRecvFrom, kWrite, kSendTo, kDisconnect };
+ enum Operation {
+ kAccept, kRead, kRecvFrom, kWrite, kSendTo, kDisconnect, kConnect
+ };
static OverlappedBuffer* AllocateAcceptBuffer(int buffer_size);
static OverlappedBuffer* AllocateReadBuffer(int buffer_size);
@@ -49,6 +51,7 @@ class OverlappedBuffer {
static OverlappedBuffer* AllocateWriteBuffer(int buffer_size);
static OverlappedBuffer* AllocateSendToBuffer(int buffer_size);
static OverlappedBuffer* AllocateDisconnectBuffer();
+ static OverlappedBuffer* AllocateConnectBuffer();
static void DisposeBuffer(OverlappedBuffer* buffer);
// Find the IO buffer from the OVERLAPPED address.
@@ -415,14 +418,18 @@ class ClientSocket : public SocketHandle {
public:
explicit ClientSocket(SOCKET s) : SocketHandle(s),
DisconnectEx_(NULL),
- next_(NULL) {
+ next_(NULL),
+ connected_(false),
+ closed_(false) {
LoadDisconnectEx();
type_ = kClientSocket;
}
ClientSocket(SOCKET s, Dart_Port port) : SocketHandle(s, port),
DisconnectEx_(NULL),
- next_(NULL) {
+ next_(NULL),
+ connected_(false),
+ closed_(false) {
LoadDisconnectEx();
type_ = kClientSocket;
}
@@ -442,6 +449,8 @@ class ClientSocket : public SocketHandle {
void IssueDisconnect();
void DisconnectComplete(OverlappedBuffer* buffer);
+ void ConnectComplete(OverlappedBuffer* buffer);
+
virtual void EnsureInitialized(
EventHandlerImplementation* event_handler);
virtual void DoClose();
@@ -450,11 +459,18 @@ class ClientSocket : public SocketHandle {
ClientSocket* next() { return next_; }
void set_next(ClientSocket* next) { next_ = next; }
+ void mark_connected() {
+ connected_ = true;
+ }
+ bool is_connected() const { return connected_; }
+
private:
bool LoadDisconnectEx();
LPFN_DISCONNECTEX DisconnectEx_;
ClientSocket* next_;
+ bool connected_;
+ bool closed_;
};
@@ -503,6 +519,9 @@ class EventHandlerImplementation {
void HandleDisconnect(ClientSocket* client_socket,
int bytes,
OverlappedBuffer* buffer);
+ void HandleConnect(ClientSocket* client_socket,
+ int bytes,
+ OverlappedBuffer* buffer);
void HandleIOCompletion(DWORD bytes, ULONG_PTR key, OVERLAPPED* overlapped);
HANDLE completion_port() { return completion_port_; }
« no previous file with comments | « no previous file | runtime/bin/eventhandler_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698