OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/base/tcp_client_socket.h" | 5 #include "net/base/tcp_client_socket.h" |
6 | 6 |
7 #include "base/memory_debug.h" | 7 #include "base/memory_debug.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "base/trace_event.h" | 10 #include "base/trace_event.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 LOG(ERROR) << "connect failed: " << err; | 99 LOG(ERROR) << "connect failed: " << err; |
100 return MapWinsockError(err); | 100 return MapWinsockError(err); |
101 } | 101 } |
102 | 102 |
103 watcher_.StartWatching(overlapped_.hEvent, this); | 103 watcher_.StartWatching(overlapped_.hEvent, this); |
104 wait_state_ = WAITING_CONNECT; | 104 wait_state_ = WAITING_CONNECT; |
105 callback_ = callback; | 105 callback_ = callback; |
106 return ERR_IO_PENDING; | 106 return ERR_IO_PENDING; |
107 } | 107 } |
108 | 108 |
109 int TCPClientSocket::ReconnectIgnoringLastError(CompletionCallback* callback) { | |
110 // No ignorable errors! | |
111 return ERR_UNEXPECTED; | |
112 } | |
113 | |
114 void TCPClientSocket::Disconnect() { | 109 void TCPClientSocket::Disconnect() { |
115 if (socket_ == INVALID_SOCKET) | 110 if (socket_ == INVALID_SOCKET) |
116 return; | 111 return; |
117 | 112 |
118 TRACE_EVENT_INSTANT("socket.disconnect", this, ""); | 113 TRACE_EVENT_INSTANT("socket.disconnect", this, ""); |
119 | 114 |
120 // Make sure the message loop is not watching this object anymore. | 115 // Make sure the message loop is not watching this object anymore. |
121 watcher_.StopWatching(); | 116 watcher_.StopWatching(); |
122 | 117 |
123 // Cancel any pending IO and wait for it to be aborted. | 118 // Cancel any pending IO and wait for it to be aborted. |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 382 |
388 void TCPClientSocket::WaitForAndResetEvent() { | 383 void TCPClientSocket::WaitForAndResetEvent() { |
389 // TODO(wtc): Remove the CHECKs after enough testing. | 384 // TODO(wtc): Remove the CHECKs after enough testing. |
390 DWORD wait_rv = WaitForSingleObject(overlapped_.hEvent, INFINITE); | 385 DWORD wait_rv = WaitForSingleObject(overlapped_.hEvent, INFINITE); |
391 CHECK(wait_rv == WAIT_OBJECT_0); | 386 CHECK(wait_rv == WAIT_OBJECT_0); |
392 BOOL ok = WSAResetEvent(overlapped_.hEvent); | 387 BOOL ok = WSAResetEvent(overlapped_.hEvent); |
393 CHECK(ok); | 388 CHECK(ok); |
394 } | 389 } |
395 | 390 |
396 } // namespace net | 391 } // namespace net |
OLD | NEW |