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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 if (!handled) { | 125 if (!handled) { |
126 LOG(ERROR) << "Received unexpected IPC type: " << message.type(); | 126 LOG(ERROR) << "Received unexpected IPC type: " << message.type(); |
127 CrashNetworkProcess(FROM_HERE); | 127 CrashNetworkProcess(FROM_HERE); |
128 } | 128 } |
129 | 129 |
130 return handled; | 130 return handled; |
131 } | 131 } |
132 | 132 |
133 void DaemonProcess::OnPermanentError(int exit_code) { | 133 void DaemonProcess::OnPermanentError(int exit_code) { |
134 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 134 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
135 DCHECK(kMinPermanentErrorExitCode <= exit_code && | |
136 exit_code <= kMaxPermanentErrorExitCode); | |
137 | |
135 Stop(); | 138 Stop(); |
136 } | 139 } |
137 | 140 |
138 void DaemonProcess::CloseDesktopSession(int terminal_id) { | 141 void DaemonProcess::CloseDesktopSession(int terminal_id) { |
139 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 142 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
140 | 143 |
141 // Validate the supplied terminal ID. An attempt to use a desktop session ID | 144 // Validate the supplied terminal ID. An attempt to use a desktop session ID |
142 // that couldn't possibly have been allocated is considered a protocol error | 145 // that couldn't possibly have been allocated is considered a protocol error |
143 // and the network process will be restarted. | 146 // and the network process will be restarted. |
144 if (!WasTerminalIdAllocated(terminal_id)) { | 147 if (!WasTerminalIdAllocated(terminal_id)) { |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, | 359 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, |
357 OnClientRouteChange(jid, channel_name, parsed_route)); | 360 OnClientRouteChange(jid, channel_name, parsed_route)); |
358 } | 361 } |
359 | 362 |
360 void DaemonProcess::OnHostStarted(const std::string& xmpp_login) { | 363 void DaemonProcess::OnHostStarted(const std::string& xmpp_login) { |
361 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 364 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
362 | 365 |
363 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, OnStart(xmpp_login)); | 366 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, OnStart(xmpp_login)); |
364 } | 367 } |
365 | 368 |
366 void DaemonProcess::OnHostShutdown() { | 369 void DaemonProcess::OnHostShutdown(int exit_code) { |
Sergey Ulanov
2015/04/07 21:50:18
It looks like ChromotingNetworkDaemonMsg_HostShutd
| |
367 DCHECK(caller_task_runner()->BelongsToCurrentThread()); | 370 DCHECK(caller_task_runner()->BelongsToCurrentThread()); |
368 | 371 |
369 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, OnShutdown()); | 372 if (kMinPermanentErrorExitCode <= exit_code && |
373 exit_code <= kMaxPermanentErrorExitCode) { | |
374 OnPermanentError(exit_code); | |
375 return; | |
376 } | |
377 FOR_EACH_OBSERVER(HostStatusObserver, status_observers_, | |
378 OnShutdown((HostExitCodes)exit_code)); | |
370 } | 379 } |
371 | 380 |
372 void DaemonProcess::DeleteAllDesktopSessions() { | 381 void DaemonProcess::DeleteAllDesktopSessions() { |
373 while (!desktop_sessions_.empty()) { | 382 while (!desktop_sessions_.empty()) { |
374 delete desktop_sessions_.front(); | 383 delete desktop_sessions_.front(); |
375 desktop_sessions_.pop_front(); | 384 desktop_sessions_.pop_front(); |
376 } | 385 } |
377 } | 386 } |
378 | 387 |
379 } // namespace remoting | 388 } // namespace remoting |
OLD | NEW |