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 "content/browser/renderer_host/p2p/socket_host_tcp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
6 | 6 |
7 #include "base/sys_byteorder.h" | 7 #include "base/sys_byteorder.h" |
8 #include "content/common/p2p_messages.h" | 8 #include "content/common/p2p_messages.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 void P2PSocketHostTcp::OnConnected(int result) { | 82 void P2PSocketHostTcp::OnConnected(int result) { |
83 DCHECK_EQ(state_, STATE_CONNECTING); | 83 DCHECK_EQ(state_, STATE_CONNECTING); |
84 DCHECK_NE(result, net::ERR_IO_PENDING); | 84 DCHECK_NE(result, net::ERR_IO_PENDING); |
85 | 85 |
86 if (result != net::OK) { | 86 if (result != net::OK) { |
87 OnError(); | 87 OnError(); |
88 return; | 88 return; |
89 } | 89 } |
90 | 90 |
91 if (socket_->SetSendBufferSize(kMaxSendBufferSize)) { | 91 if (!socket_->SetSendBufferSize(kMaxSendBufferSize)) { |
92 LOG(WARNING) << "Failed to set send buffer size for TCP socket."; | 92 LOG(WARNING) << "Failed to set send buffer size for TCP socket."; |
93 } | 93 } |
94 | 94 |
95 net::IPEndPoint address; | 95 net::IPEndPoint address; |
96 result = socket_->GetLocalAddress(&address); | 96 result = socket_->GetLocalAddress(&address); |
97 if (result < 0) { | 97 if (result < 0) { |
98 LOG(ERROR) << "P2PSocket::Init(): unable to get local address: " | 98 LOG(ERROR) << "P2PSocket::Init(): unable to get local address: " |
99 << result; | 99 << result; |
100 OnError(); | 100 OnError(); |
101 return; | 101 return; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 268 } |
269 | 269 |
270 P2PSocketHost* P2PSocketHostTcp::AcceptIncomingTcpConnection( | 270 P2PSocketHost* P2PSocketHostTcp::AcceptIncomingTcpConnection( |
271 const net::IPEndPoint& remote_address, int id) { | 271 const net::IPEndPoint& remote_address, int id) { |
272 NOTREACHED(); | 272 NOTREACHED(); |
273 OnError(); | 273 OnError(); |
274 return NULL; | 274 return NULL; |
275 } | 275 } |
276 | 276 |
277 } // namespace content | 277 } // namespace content |
OLD | NEW |