| 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_dispatcher_host.h" | 5 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "content/browser/renderer_host/p2p/socket_host.h" | 9 #include "content/browser/renderer_host/p2p/socket_host.h" |
| 10 #include "content/common/p2p_messages.h" | 10 #include "content/common/p2p_messages.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 P2PSocketHost* accepted_connection = | 217 P2PSocketHost* accepted_connection = |
| 218 socket->AcceptIncomingTcpConnection(remote_address, connected_socket_id); | 218 socket->AcceptIncomingTcpConnection(remote_address, connected_socket_id); |
| 219 if (accepted_connection) { | 219 if (accepted_connection) { |
| 220 sockets_[connected_socket_id] = accepted_connection; | 220 sockets_[connected_socket_id] = accepted_connection; |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 void P2PSocketDispatcherHost::OnSend(int socket_id, | 224 void P2PSocketDispatcherHost::OnSend(int socket_id, |
| 225 const net::IPEndPoint& socket_address, | 225 const net::IPEndPoint& socket_address, |
| 226 const std::vector<char>& data) { | 226 const std::vector<char>& data, |
| 227 net::DiffServCodePoint dscp) { |
| 227 P2PSocketHost* socket = LookupSocket(socket_id); | 228 P2PSocketHost* socket = LookupSocket(socket_id); |
| 228 if (!socket) { | 229 if (!socket) { |
| 229 LOG(ERROR) << "Received P2PHostMsg_Send for invalid socket_id."; | 230 LOG(ERROR) << "Received P2PHostMsg_Send for invalid socket_id."; |
| 230 return; | 231 return; |
| 231 } | 232 } |
| 232 socket->Send(socket_address, data); | 233 socket->Send(socket_address, data, dscp); |
| 233 } | 234 } |
| 234 | 235 |
| 235 void P2PSocketDispatcherHost::OnDestroySocket(int socket_id) { | 236 void P2PSocketDispatcherHost::OnDestroySocket(int socket_id) { |
| 236 SocketsMap::iterator it = sockets_.find(socket_id); | 237 SocketsMap::iterator it = sockets_.find(socket_id); |
| 237 if (it != sockets_.end()) { | 238 if (it != sockets_.end()) { |
| 238 delete it->second; | 239 delete it->second; |
| 239 sockets_.erase(it); | 240 sockets_.erase(it); |
| 240 } else { | 241 } else { |
| 241 LOG(ERROR) << "Received P2PHostMsg_DestroySocket for invalid socket_id."; | 242 LOG(ERROR) << "Received P2PHostMsg_DestroySocket for invalid socket_id."; |
| 242 } | 243 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 258 void P2PSocketDispatcherHost::OnAddressResolved( | 259 void P2PSocketDispatcherHost::OnAddressResolved( |
| 259 DnsRequest* request, | 260 DnsRequest* request, |
| 260 const net::IPAddressNumber& result) { | 261 const net::IPAddressNumber& result) { |
| 261 Send(new P2PMsg_GetHostAddressResult(request->request_id(), result)); | 262 Send(new P2PMsg_GetHostAddressResult(request->request_id(), result)); |
| 262 | 263 |
| 263 dns_requests_.erase(request); | 264 dns_requests_.erase(request); |
| 264 delete request; | 265 delete request; |
| 265 } | 266 } |
| 266 | 267 |
| 267 } // namespace content | 268 } // namespace content |
| OLD | NEW |