diff options
author | wtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-05 23:15:36 +0000 |
---|---|---|
committer | wtc@google.com <wtc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-05 23:15:36 +0000 |
commit | 836dff30efbff95f2090a024da25debe4edd2f83 (patch) | |
tree | 9b07faaabad76f19a30769a9bdcd1ee5e3e47b2a /net/base/tcp_client_socket.h | |
parent | a218f15b205006e999a0dcabd7ebbe631def4e3b (diff) | |
download | chromium_src-836dff30efbff95f2090a024da25debe4edd2f83.zip chromium_src-836dff30efbff95f2090a024da25debe4edd2f83.tar.gz chromium_src-836dff30efbff95f2090a024da25debe4edd2f83.tar.bz2 |
Make some changes from my code review. Two significant
changes are:
1. Call WSAEventSelect before connect to fix a race
condition.
2. Call WSAResetEvent before WSARecv and WSASend because
the event is manual-reset and WSAGetOverlappedResult
doesn't reset the event for us.
R=darin
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@406 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/tcp_client_socket.h')
-rw-r--r-- | net/base/tcp_client_socket.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/base/tcp_client_socket.h b/net/base/tcp_client_socket.h index e5c8ca9..3885026 100644 --- a/net/base/tcp_client_socket.h +++ b/net/base/tcp_client_socket.h @@ -38,13 +38,17 @@ namespace net { +// A client socket that uses TCP as the transport layer. +// +// NOTE: The implementation supports half duplex only. Read and Write calls +// must not be in progress at the same time. class TCPClientSocket : public ClientSocket, public base::ObjectWatcher::Delegate { public: // The IP address(es) and port number to connect to. The TCP socket will try // each IP address in the list until it succeeds in establishing a // connection. - TCPClientSocket(const AddressList& addresses); + explicit TCPClientSocket(const AddressList& addresses); ~TCPClientSocket(); @@ -64,6 +68,7 @@ class TCPClientSocket : public ClientSocket, void DidCompleteConnect(); void DidCompleteIO(); + // MessageLoop::Watcher methods: virtual void OnObjectSignaled(HANDLE object); SOCKET socket_; @@ -74,11 +79,11 @@ class TCPClientSocket : public ClientSocket, CompletionCallback* callback_; - // Stored outside of the context so we can both lazily construct the context - // as well as construct a new one if Connect is called after Close. + // The list of addresses we should try in order to establish a connection. AddressList addresses_; - // The addrinfo that we are attempting to use or NULL if uninitialized. + // The addrinfo that we are attempting to use or NULL if all addrinfos have + // been tried. const struct addrinfo* current_ai_; enum WaitState { |