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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 | 582 |
583 previously_disconnected_ = true; | 583 previously_disconnected_ = true; |
584 } | 584 } |
585 | 585 |
586 bool TCPClientSocketWin::IsConnected() const { | 586 bool TCPClientSocketWin::IsConnected() const { |
587 DCHECK(CalledOnValidThread()); | 587 DCHECK(CalledOnValidThread()); |
588 | 588 |
589 if (socket_ == INVALID_SOCKET || waiting_connect()) | 589 if (socket_ == INVALID_SOCKET || waiting_connect()) |
590 return false; | 590 return false; |
591 | 591 |
592 if (waiting_read_ || waiting_write_) | |
593 return true; | |
wtc
2011/09/30 19:02:43
Any change we make to TCPClientSocketWin::IsConnec
Takashi Toyoshima
2011/10/04 03:38:35
Done.
| |
594 | |
592 // Check if connection is alive. | 595 // Check if connection is alive. |
593 char c; | 596 char c; |
594 int rv = recv(socket_, &c, 1, MSG_PEEK); | 597 int rv = recv(socket_, &c, 1, MSG_PEEK); |
595 if (rv == 0) | 598 if (rv == 0) |
596 return false; | 599 return false; |
597 if (rv == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK) | 600 if (rv == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK) |
598 return false; | 601 return false; |
599 | 602 |
600 return true; | 603 return true; |
601 } | 604 } |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
898 use_history_.set_was_used_to_convey_data(); | 901 use_history_.set_was_used_to_convey_data(); |
899 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT, num_bytes, | 902 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT, num_bytes, |
900 core_->write_buffer_.buf); | 903 core_->write_buffer_.buf); |
901 } | 904 } |
902 } | 905 } |
903 core_->write_iobuffer_ = NULL; | 906 core_->write_iobuffer_ = NULL; |
904 DoWriteCallback(rv); | 907 DoWriteCallback(rv); |
905 } | 908 } |
906 | 909 |
907 } // namespace net | 910 } // namespace net |
OLD | NEW |