summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/win/object_watcher.h2
-rw-r--r--net/socket/tcp_client_socket_libevent.cc3
-rw-r--r--net/socket/tcp_server_socket_libevent.cc4
3 files changed, 6 insertions, 3 deletions
diff --git a/base/win/object_watcher.h b/base/win/object_watcher.h
index 4cc6090..7e2de77 100644
--- a/base/win/object_watcher.h
+++ b/base/win/object_watcher.h
@@ -48,7 +48,7 @@ class BASE_API ObjectWatcher : public MessageLoop::DestructionObserver {
public:
virtual ~Delegate() {}
// Called from the MessageLoop when a signaled object is detected. To
- // continue watching the object, AddWatch must be called again.
+ // continue watching the object, StartWatching must be called again.
virtual void OnObjectSignaled(HANDLE object) = 0;
};
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!
}
diff --git a/net/socket/tcp_server_socket_libevent.cc b/net/socket/tcp_server_socket_libevent.cc
index 02c448a..3e25fab 100644
--- a/net/socket/tcp_server_socket_libevent.cc
+++ b/net/socket/tcp_server_socket_libevent.cc
@@ -172,6 +172,8 @@ int TCPServerSocketLibevent::AcceptInternal(
void TCPServerSocketLibevent::Close() {
if (socket_ != kInvalidSocket) {
+ bool ok = accept_socket_watcher_.StopWatchingFileDescriptor();
+ DCHECK(ok);
if (HANDLE_EINTR(close(socket_)) < 0)
PLOG(ERROR) << "close";
socket_ = kInvalidSocket;
@@ -186,6 +188,8 @@ void TCPServerSocketLibevent::OnFileCanReadWithoutBlocking(int fd) {
CompletionCallback* c = accept_callback_;
accept_callback_ = NULL;
accept_socket_ = NULL;
+ bool ok = accept_socket_watcher_.StopWatchingFileDescriptor();
+ DCHECK(ok);
c->Run(result);
}
}