| 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_; }
|
|
|