Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_socket.h" | 5 #include "net/socket/tcp_socket.h" |
| 6 #include "net/socket/tcp_socket_win.h" | 6 #include "net/socket/tcp_socket_win.h" |
| 7 | 7 |
| 8 #include <errno.h> | |
|
xunjieli
2015/11/09 21:53:29
Why do we need this header for this file?
Mostyn Bramley-Moore
2015/11/09 23:13:08
Because the errno variable is used (on line 623).
| |
| 8 #include <mstcpip.h> | 9 #include <mstcpip.h> |
| 9 | 10 |
| 10 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/profiler/scoped_tracker.h" | 13 #include "base/profiler/scoped_tracker.h" |
| 13 #include "base/win/windows_version.h" | 14 #include "base/win/windows_version.h" |
| 14 #include "net/base/address_list.h" | 15 #include "net/base/address_list.h" |
| 15 #include "net/base/connection_type_histograms.h" | 16 #include "net/base/connection_type_histograms.h" |
| 16 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
| 17 #include "net/base/ip_endpoint.h" | 18 #include "net/base/ip_endpoint.h" |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 // | 613 // |
| 613 // SO_EXCLUSIVEADDRUSE will prevent a TCP client socket from binding to an end | 614 // SO_EXCLUSIVEADDRUSE will prevent a TCP client socket from binding to an end |
| 614 // point in TIME_WAIT status. It does not have this effect for a TCP server | 615 // point in TIME_WAIT status. It does not have this effect for a TCP server |
| 615 // socket. | 616 // socket. |
| 616 | 617 |
| 617 BOOL true_value = 1; | 618 BOOL true_value = 1; |
| 618 int rv = setsockopt(socket_, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, | 619 int rv = setsockopt(socket_, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, |
| 619 reinterpret_cast<const char*>(&true_value), | 620 reinterpret_cast<const char*>(&true_value), |
| 620 sizeof(true_value)); | 621 sizeof(true_value)); |
| 621 if (rv < 0) | 622 if (rv < 0) |
| 622 return MapSystemError(errno); | 623 return MapSystemError(errno); |
|
Mostyn Bramley-Moore
2015/11/09 23:13:08
Note the errno variable being used here.
| |
| 623 return OK; | 624 return OK; |
| 624 } | 625 } |
| 625 | 626 |
| 626 int TCPSocketWin::SetReceiveBufferSize(int32 size) { | 627 int TCPSocketWin::SetReceiveBufferSize(int32 size) { |
| 627 DCHECK(CalledOnValidThread()); | 628 DCHECK(CalledOnValidThread()); |
| 628 return SetSocketReceiveBufferSize(socket_, size); | 629 return SetSocketReceiveBufferSize(socket_, size); |
| 629 } | 630 } |
| 630 | 631 |
| 631 int TCPSocketWin::SetSendBufferSize(int32 size) { | 632 int TCPSocketWin::SetSendBufferSize(int32 size) { |
| 632 DCHECK(CalledOnValidThread()); | 633 DCHECK(CalledOnValidThread()); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1048 } | 1049 } |
| 1049 | 1050 |
| 1050 bool TCPSocketWin::GetEstimatedRoundTripTime(base::TimeDelta* out_rtt) const { | 1051 bool TCPSocketWin::GetEstimatedRoundTripTime(base::TimeDelta* out_rtt) const { |
| 1051 DCHECK(out_rtt); | 1052 DCHECK(out_rtt); |
| 1052 // TODO(bmcquade): Consider implementing using | 1053 // TODO(bmcquade): Consider implementing using |
| 1053 // GetPerTcpConnectionEStats/GetPerTcp6ConnectionEStats. | 1054 // GetPerTcpConnectionEStats/GetPerTcp6ConnectionEStats. |
| 1054 return false; | 1055 return false; |
| 1055 } | 1056 } |
| 1056 | 1057 |
| 1057 } // namespace net | 1058 } // namespace net |
| OLD | NEW |