| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 350 |
| 351 TCPClientSocketWin::~TCPClientSocketWin() { | 351 TCPClientSocketWin::~TCPClientSocketWin() { |
| 352 Disconnect(); | 352 Disconnect(); |
| 353 net_log_.EndEvent(NetLog::TYPE_SOCKET_ALIVE); | 353 net_log_.EndEvent(NetLog::TYPE_SOCKET_ALIVE); |
| 354 } | 354 } |
| 355 | 355 |
| 356 int TCPClientSocketWin::AdoptSocket(SOCKET socket) { | 356 int TCPClientSocketWin::AdoptSocket(SOCKET socket) { |
| 357 DCHECK_EQ(socket_, INVALID_SOCKET); | 357 DCHECK_EQ(socket_, INVALID_SOCKET); |
| 358 | 358 |
| 359 int error = SetupSocket(socket); | 359 int error = SetupSocket(socket); |
| 360 if (error) | 360 if (error) { |
| 361 if (closesocket(socket) < 0) |
| 362 PLOG(ERROR) << "closesocket"; |
| 361 return MapSystemError(error); | 363 return MapSystemError(error); |
| 364 } |
| 362 | 365 |
| 363 socket_ = socket; | 366 socket_ = socket; |
| 364 SetNonBlocking(socket_); | 367 SetNonBlocking(socket_); |
| 365 | 368 |
| 366 core_ = new Core(this); | 369 core_ = new Core(this); |
| 367 current_address_index_ = 0; | 370 current_address_index_ = 0; |
| 368 use_history_.set_was_ever_connected(); | 371 use_history_.set_was_ever_connected(); |
| 369 | 372 |
| 370 return OK; | 373 return OK; |
| 371 } | 374 } |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 core_->WatchForRead(); | 1039 core_->WatchForRead(); |
| 1037 return; | 1040 return; |
| 1038 } | 1041 } |
| 1039 waiting_read_ = false; | 1042 waiting_read_ = false; |
| 1040 core_->read_iobuffer_ = NULL; | 1043 core_->read_iobuffer_ = NULL; |
| 1041 core_->read_buffer_length_ = 0; | 1044 core_->read_buffer_length_ = 0; |
| 1042 DoReadCallback(rv); | 1045 DoReadCallback(rv); |
| 1043 } | 1046 } |
| 1044 | 1047 |
| 1045 } // namespace net | 1048 } // namespace net |
| OLD | NEW |