diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-20 17:29:54 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-20 17:29:54 +0000 |
commit | d25db326524782ebb860c68bcfb818c9c2c4ca14 (patch) | |
tree | 1cf3d3b3d39b801a237293576acc3f332bd5a5d9 /net/socket/tcp_client_socket_win.cc | |
parent | eb564a1c1799cd40796403f8af9fdc616f590653 (diff) | |
download | chromium_src-d25db326524782ebb860c68bcfb818c9c2c4ca14.zip chromium_src-d25db326524782ebb860c68bcfb818c9c2c4ca14.tar.gz chromium_src-d25db326524782ebb860c68bcfb818c9c2c4ca14.tar.bz2 |
Revert 122760 - While calling IO methods on accepted TCP sockets we run into problem that AssertEventNotSignaled is triggered in TCPClientSocketWin::{Read|Write} methods. This CL fixes this issue and adds test.
BUG=99602
TEST=TCPServerSocketTest
Review URL: http://codereview.chromium.org/9413007
TBR=ygorshenin@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9423044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122763 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/tcp_client_socket_win.cc')
-rw-r--r-- | net/socket/tcp_client_socket_win.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc index 196522d..b5921b9 100644 --- a/net/socket/tcp_client_socket_win.cc +++ b/net/socket/tcp_client_socket_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -256,9 +256,6 @@ TCPClientSocketWin::Core::Core( slow_start_throttle_(kInitialSlowStartThrottle) { memset(&read_overlapped_, 0, sizeof(read_overlapped_)); memset(&write_overlapped_, 0, sizeof(write_overlapped_)); - - read_overlapped_.hEvent = WSACreateEvent(); - write_overlapped_.hEvent = WSACreateEvent(); } TCPClientSocketWin::Core::~Core() { @@ -345,10 +342,7 @@ int TCPClientSocketWin::AdoptSocket(SOCKET socket) { return MapSystemError(error); socket_ = socket; - SetNonBlocking(socket_); - core_ = new Core(this); - current_ai_ = addresses_.head(); use_history_.set_was_ever_connected(); @@ -480,10 +474,15 @@ int TCPClientSocketWin::DoConnect() { DCHECK(!core_); core_ = new Core(this); + + // WSACreateEvent creates a manual-reset event object. + core_->read_overlapped_.hEvent = WSACreateEvent(); // WSAEventSelect sets the socket to non-blocking mode as a side effect. // Our connect() and recv() calls require that the socket be non-blocking. WSAEventSelect(socket_, core_->read_overlapped_.hEvent, FD_CONNECT); + core_->write_overlapped_.hEvent = WSACreateEvent(); + connect_start_time_ = base::TimeTicks::Now(); if (!connect(socket_, ai->ai_addr, static_cast<int>(ai->ai_addrlen))) { // Connected without waiting! |