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 "remoting/host/daemon_process.h" | 5 #include "remoting/host/daemon_process.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 | 325 |
326 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, | 326 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, |
327 OnClientDisconnected(jid)); | 327 OnClientDisconnected(jid)); |
328 } | 328 } |
329 | 329 |
330 void DaemonProcess::OnClientRouteChange(const std::string& jid, | 330 void DaemonProcess::OnClientRouteChange(const std::string& jid, |
331 const std::string& channel_name, | 331 const std::string& channel_name, |
332 const SerializedTransportRoute& route) { | 332 const SerializedTransportRoute& route) { |
333 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 333 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
334 | 334 |
335 // Validate |route|. | |
martijnc
2016/04/05 17:02:36
If I understand the IPC macro correctly, IPC shoul
| |
336 if (route.type != protocol::TransportRoute::DIRECT && | |
337 route.type != protocol::TransportRoute::STUN && | |
338 route.type != protocol::TransportRoute::RELAY) { | |
339 LOG(ERROR) << "An invalid RouteType " << route.type << " passed."; | |
340 CrashNetworkProcess(FROM_HERE); | |
341 return; | |
342 } | |
343 if (route.remote_address.size() != net::kIPv4AddressSize && | |
344 route.remote_address.size() != net::kIPv6AddressSize) { | |
345 LOG(ERROR) << "An invalid net::IPAddressNumber size " | |
346 << route.remote_address.size() << " passed."; | |
347 CrashNetworkProcess(FROM_HERE); | |
348 return; | |
349 } | |
350 if (route.local_address.size() != net::kIPv4AddressSize && | |
351 route.local_address.size() != net::kIPv6AddressSize) { | |
352 LOG(ERROR) << "An invalid net::IPAddressNumber size " | |
353 << route.local_address.size() << " passed."; | |
354 CrashNetworkProcess(FROM_HERE); | |
355 return; | |
356 } | |
357 | |
358 protocol::TransportRoute parsed_route; | 335 protocol::TransportRoute parsed_route; |
359 parsed_route.type = | 336 parsed_route.type = route.type; |
360 static_cast<protocol::TransportRoute::RouteType>(route.type); | 337 parsed_route.remote_address = route.remote_address; |
361 parsed_route.remote_address = | 338 parsed_route.local_address = route.local_address; |
362 net::IPEndPoint(route.remote_address, route.remote_port); | |
363 parsed_route.local_address = | |
364 net::IPEndPoint(route.local_address, route.local_port); | |
365 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, | 339 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, |
366 OnClientRouteChange(jid, channel_name, parsed_route)); | 340 OnClientRouteChange(jid, channel_name, parsed_route)); |
367 } | 341 } |
368 | 342 |
369 void DaemonProcess::OnHostStarted(const std::string& xmpp_login) { | 343 void DaemonProcess::OnHostStarted(const std::string& xmpp_login) { |
370 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 344 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
371 | 345 |
372 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, OnStart(xmpp_login)); | 346 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, OnStart(xmpp_login)); |
373 } | 347 } |
374 | 348 |
375 void DaemonProcess::OnHostShutdown() { | 349 void DaemonProcess::OnHostShutdown() { |
376 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 350 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
377 | 351 |
378 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, OnShutdown()); | 352 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, OnShutdown()); |
379 } | 353 } |
380 | 354 |
381 void DaemonProcess::DeleteAllDesktopSessions() { | 355 void DaemonProcess::DeleteAllDesktopSessions() { |
382 while (!desktop_sessions_.empty()) { | 356 while (!desktop_sessions_.empty()) { |
383 delete desktop_sessions_.front(); | 357 delete desktop_sessions_.front(); |
384 desktop_sessions_.pop_front(); | 358 desktop_sessions_.pop_front(); |
385 } | 359 } |
386 } | 360 } |
387 | 361 |
388 } // namespace remoting | 362 } // namespace remoting |
OLD | NEW |