diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-25 02:17:56 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-25 02:17:56 +0000 |
commit | 62755f824d5d77d0d110d3cc4e3f7614632e29ee (patch) | |
tree | f328efdc69b6c022084e5f6be5f3a42a17088a8a /net/socket/tcp_client_socket_libevent.cc | |
parent | 33c141aefc29ca5523cb2d462835969b6b3a5bf3 (diff) | |
download | chromium_src-62755f824d5d77d0d110d3cc4e3f7614632e29ee.zip chromium_src-62755f824d5d77d0d110d3cc4e3f7614632e29ee.tar.gz chromium_src-62755f824d5d77d0d110d3cc4e3f7614632e29ee.tar.bz2 |
TCPServerSocketLibevent should call StopWatchingFileDescriptor()
when Accept() completes asynchronously (because Accept() calls
WatchFileDescriptor() in persistent mode) or before it closes
socket_. This matches what TCPClientSocketLibevent does.
Without this fix, the TCPServerSocketTest.Accept2Connections unit
test may crash in accept_callback.WaitForResult() for some message
loop scheduling policies because two connections are ready to be
accepted but only one accept_socket_ is provided.
Fix a comment typo in object_watcher.h.
Avoid a redundant StopWatchingFileDescriptor call in
TCPClientSocketLibevent.
R=sergeyu@chromium.org,willchan@chromium.org
BUG=none
TEST=covered by existing unit tests
Review URL: http://codereview.chromium.org/7239018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/tcp_client_socket_libevent.cc')
-rw-r--r-- | net/socket/tcp_client_socket_libevent.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index 38c3446..3c5ec13 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -336,9 +336,8 @@ int TCPClientSocketLibevent::DoConnectComplete(int result) { params = new NetLogIntegerParameter("os_error", os_error); net_log_.EndEvent(NetLog::TYPE_TCP_CONNECT_ATTEMPT, params); - write_socket_watcher_.StopWatchingFileDescriptor(); - if (result == OK) { + write_socket_watcher_.StopWatchingFileDescriptor(); use_history_.set_was_ever_connected(); return OK; // Done! } |