| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/socket/tcp_client_socket_win.h" | 5 #include "net/socket/tcp_client_socket_win.h" |
| 6 | 6 |
| 7 #include <mstcpip.h> | 7 #include <mstcpip.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 TCPClientSocketWin::~TCPClientSocketWin() { | 232 TCPClientSocketWin::~TCPClientSocketWin() { |
| 233 Disconnect(); | 233 Disconnect(); |
| 234 net_log_.EndEvent(NetLog::TYPE_SOCKET_ALIVE, NULL); | 234 net_log_.EndEvent(NetLog::TYPE_SOCKET_ALIVE, NULL); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void TCPClientSocketWin::AdoptSocket(SOCKET socket) { | 237 void TCPClientSocketWin::AdoptSocket(SOCKET socket) { |
| 238 DCHECK_EQ(socket_, INVALID_SOCKET); | 238 DCHECK_EQ(socket_, INVALID_SOCKET); |
| 239 socket_ = socket; | 239 socket_ = socket; |
| 240 int error = SetupSocket(); | 240 int error = SetupSocket(); |
| 241 DCHECK_EQ(0, error); | 241 DCHECK_EQ(0, error); |
| 242 core_ = new Core(this); |
| 242 current_ai_ = addresses_.head(); | 243 current_ai_ = addresses_.head(); |
| 243 use_history_.set_was_ever_connected(); | 244 use_history_.set_was_ever_connected(); |
| 244 } | 245 } |
| 245 | 246 |
| 246 int TCPClientSocketWin::Connect(CompletionCallback* callback) { | 247 int TCPClientSocketWin::Connect(CompletionCallback* callback) { |
| 247 DCHECK(CalledOnValidThread()); | 248 DCHECK(CalledOnValidThread()); |
| 248 | 249 |
| 249 // If already connected, then just return OK. | 250 // If already connected, then just return OK. |
| 250 if (socket_ != INVALID_SOCKET) | 251 if (socket_ != INVALID_SOCKET) |
| 251 return OK; | 252 return OK; |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 use_history_.set_was_used_to_convey_data(); | 807 use_history_.set_was_used_to_convey_data(); |
| 807 LogByteTransfer(net_log_, NetLog::TYPE_SOCKET_BYTES_SENT, num_bytes, | 808 LogByteTransfer(net_log_, NetLog::TYPE_SOCKET_BYTES_SENT, num_bytes, |
| 808 core_->write_buffer_.buf); | 809 core_->write_buffer_.buf); |
| 809 } | 810 } |
| 810 } | 811 } |
| 811 core_->write_iobuffer_ = NULL; | 812 core_->write_iobuffer_ = NULL; |
| 812 DoWriteCallback(rv); | 813 DoWriteCallback(rv); |
| 813 } | 814 } |
| 814 | 815 |
| 815 } // namespace net | 816 } // namespace net |
| OLD | NEW |