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