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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 char c; | 628 char c; |
629 int rv = recv(socket_, &c, 1, MSG_PEEK); | 629 int rv = recv(socket_, &c, 1, MSG_PEEK); |
630 if (rv >= 0) | 630 if (rv >= 0) |
631 return false; | 631 return false; |
632 if (WSAGetLastError() != WSAEWOULDBLOCK) | 632 if (WSAGetLastError() != WSAEWOULDBLOCK) |
633 return false; | 633 return false; |
634 | 634 |
635 return true; | 635 return true; |
636 } | 636 } |
637 | 637 |
638 int TCPClientSocketWin::GetPeerAddress(AddressList* address) const { | 638 int TCPClientSocketWin::GetPeerAddress(IPEndPoint* address) const { |
639 DCHECK(CalledOnValidThread()); | 639 DCHECK(CalledOnValidThread()); |
640 DCHECK(address); | 640 DCHECK(address); |
641 if (!IsConnected()) | 641 if (!IsConnected()) |
642 return ERR_SOCKET_NOT_CONNECTED; | 642 return ERR_SOCKET_NOT_CONNECTED; |
643 *address = AddressList(addresses_[current_address_index_]); | 643 *address = addresses_[current_address_index_]; |
644 return OK; | 644 return OK; |
645 } | 645 } |
646 | 646 |
647 int TCPClientSocketWin::GetLocalAddress(IPEndPoint* address) const { | 647 int TCPClientSocketWin::GetLocalAddress(IPEndPoint* address) const { |
648 DCHECK(CalledOnValidThread()); | 648 DCHECK(CalledOnValidThread()); |
649 DCHECK(address); | 649 DCHECK(address); |
650 if (!IsConnected()) | 650 if (!IsConnected()) |
651 return ERR_SOCKET_NOT_CONNECTED; | 651 return ERR_SOCKET_NOT_CONNECTED; |
652 | 652 |
653 struct sockaddr_storage addr_storage; | 653 struct sockaddr_storage addr_storage; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 use_history_.set_was_used_to_convey_data(); | 927 use_history_.set_was_used_to_convey_data(); |
928 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT, num_bytes, | 928 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT, num_bytes, |
929 core_->write_buffer_.buf); | 929 core_->write_buffer_.buf); |
930 } | 930 } |
931 } | 931 } |
932 core_->write_iobuffer_ = NULL; | 932 core_->write_iobuffer_ = NULL; |
933 DoWriteCallback(rv); | 933 DoWriteCallback(rv); |
934 } | 934 } |
935 | 935 |
936 } // namespace net | 936 } // namespace net |
OLD | NEW |