| 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_udp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "content/browser/renderer_host/p2p/socket_host_throttler.h" | 10 #include "content/browser/renderer_host/p2p/socket_host_throttler.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 P2PSocketHostUdp::~P2PSocketHostUdp() { | 78 P2PSocketHostUdp::~P2PSocketHostUdp() { |
| 79 if (state_ == STATE_OPEN) { | 79 if (state_ == STATE_OPEN) { |
| 80 DCHECK(socket_.get()); | 80 DCHECK(socket_.get()); |
| 81 socket_.reset(); | 81 socket_.reset(); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool P2PSocketHostUdp::Init(const net::IPEndPoint& local_address, | 85 bool P2PSocketHostUdp::Init(const net::IPEndPoint& local_address, |
| 86 const net::IPEndPoint& remote_address) { | 86 const P2PHostAndIPEndPoint& remote_address) { |
| 87 DCHECK_EQ(state_, STATE_UNINITIALIZED); | 87 DCHECK_EQ(state_, STATE_UNINITIALIZED); |
| 88 | 88 |
| 89 int result = socket_->Listen(local_address); | 89 int result = socket_->Listen(local_address); |
| 90 if (result < 0) { | 90 if (result < 0) { |
| 91 LOG(ERROR) << "bind() failed: " << result; | 91 LOG(ERROR) << "bind() failed: " << result; |
| 92 OnError(); | 92 OnError(); |
| 93 return false; | 93 return false; |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Setting recv socket buffer size. | 96 // Setting recv socket buffer size. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 case P2P_SOCKET_OPT_DSCP: | 305 case P2P_SOCKET_OPT_DSCP: |
| 306 return (net::OK == socket_->SetDiffServCodePoint( | 306 return (net::OK == socket_->SetDiffServCodePoint( |
| 307 static_cast<net::DiffServCodePoint>(value))) ? true : false; | 307 static_cast<net::DiffServCodePoint>(value))) ? true : false; |
| 308 default: | 308 default: |
| 309 NOTREACHED(); | 309 NOTREACHED(); |
| 310 return false; | 310 return false; |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace content | 314 } // namespace content |
| OLD | NEW |