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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 if (result < 0) { | 106 if (result < 0) { |
107 LOG(ERROR) << "P2PSocketHostUdp::Init(): unable to get local address: " | 107 LOG(ERROR) << "P2PSocketHostUdp::Init(): unable to get local address: " |
108 << result; | 108 << result; |
109 OnError(); | 109 OnError(); |
110 return false; | 110 return false; |
111 } | 111 } |
112 VLOG(1) << "Local address: " << address.ToString(); | 112 VLOG(1) << "Local address: " << address.ToString(); |
113 | 113 |
114 state_ = STATE_OPEN; | 114 state_ = STATE_OPEN; |
115 | 115 |
116 message_sender_->Send(new P2PMsg_OnSocketCreated(id_, address)); | 116 // NOTE: Remote address will be same as what renderer provided. |
| 117 message_sender_->Send(new P2PMsg_OnSocketCreated( |
| 118 id_, address, remote_address.ip_address)); |
117 | 119 |
118 recv_buffer_ = new net::IOBuffer(kReadBufferSize); | 120 recv_buffer_ = new net::IOBuffer(kReadBufferSize); |
119 DoRead(); | 121 DoRead(); |
120 | 122 |
121 return true; | 123 return true; |
122 } | 124 } |
123 | 125 |
124 void P2PSocketHostUdp::OnError() { | 126 void P2PSocketHostUdp::OnError() { |
125 socket_.reset(); | 127 socket_.reset(); |
126 send_queue_.clear(); | 128 send_queue_.clear(); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 case P2P_SOCKET_OPT_DSCP: | 318 case P2P_SOCKET_OPT_DSCP: |
317 return (net::OK == socket_->SetDiffServCodePoint( | 319 return (net::OK == socket_->SetDiffServCodePoint( |
318 static_cast<net::DiffServCodePoint>(value))) ? true : false; | 320 static_cast<net::DiffServCodePoint>(value))) ? true : false; |
319 default: | 321 default: |
320 NOTREACHED(); | 322 NOTREACHED(); |
321 return false; | 323 return false; |
322 } | 324 } |
323 } | 325 } |
324 | 326 |
325 } // namespace content | 327 } // namespace content |
OLD | NEW |