Last update: 2013-06-20
I introduced two important modules into boinc client. In this page I describe shortly these modules and their purposes:
ClientMonitor - monitors event inside BOINC client.
This module just sends event to manager through new communication channel (in the port 31417). Currently I defined only 6 events, whose can be sent to manager:
- ATTACH_PROJECT (code 1) - when client attaches to new project.
- DETACH_PROJECT (code 2) - when client detaches from project.
- SUSPEND_ALL_TASK (code 3) - when client suspends all tasks
- RUN_TASKS (code 4) - when client resumes one of the tasks.
- RUN_BENCHMARK (code 5) - when run benchmarks
- FINISH_BENCHMARK (code 6) - when client finishes benchmarks
- BEGIN_DOWNLOAD (code 7) - when client finishes benchmarks, will be implemented later
- FINISH_BENCHMARK (code 8) - when client finishes benchmarks, will be implemented later
- BATTERY_NOT_DETECTED (code 9) - when client cant detect battery type
Format of the message:
<reply>
<type>{code}</type>
<project>{project_url}</project>
<suspend_reason>{suspend_reason}</suspend_reason>
</reply>
suspend_reason field contains code which determines suspend reason. All suspend reason codes are in 'lib/common_defs.h' file in boinc client sources. Suspend reason field is filled for SUSPEND_ALL_TASK event. Now NativeBOINC is using a 'suspend_reason' field to detecting CPU throttling by BOINC, which will be ignored during displaying notifications (notifications won't be displayed).
First event is used during installation. After receiving ATTACH_PROJECT NativeBOINC manager installs binaries of the new project (if exists in the my repository). Rest of events excluding DETACH_PROJECT are used to power management by NativeBOINC manager (triggers holding or releasing wake locks).
I introduced 'auth_monitor' GUI RPC request for performing monitor authorization (see code).
GUI RPC extensions:
- auth_monitor - authorizes access to monitor
returns:
<value>{auth_code}</value>
- authorization code client monitor<failed/>
- when failed
Client monitor can sent events only to a localhost clients.
Modified or introduced sources codes (client directory):
- monitor.cpp, monitor.h - main module
- client_state.cpp, client_state.h - support for main an awaiting routine (do_io_or_sleep).
- gui_rpc_server_ops.cpp - GUI RPC request
Update_apps - updates binaries of application for specified project
This is my GUI RPC extension. Allows to installation of the project binaries during client work. Copies files from 'updates/project_dir' directory to 'projects/project_dir' directory with applying permissions for executables. Also suspends tasks when tasks of specified project were ran. After updates resumes suspended tasks.
I added two new GUI RPC extensions:
- update_project_apps - main request which triggers updating.
input:
<project_url>{project_url}</project_url>
- project url which binaries should be installed
returns:
<success/>
- when success<error>{message}</error>
- when failed
<failed/>
- when failed - update_project_apps_poll - it polls updating for specified project
input:
<project_url>{project_url}</project_url>
- project url which binaries should be installed
returns:
<update_project_apps_reply>
- when successfully updated
<message>OK</message>
</update_project_apps_reply>
<update_project_apps_reply>
- when not finished (ERR_IN_PROGRESS) or failed (other code)
<error_num>{erro_code}</error_num>
</update_project_apps_reply>
Retrieving a battery state from foreign application
New GUI RPC extension is 'battery_info' allow to sending to BOINC client informations about battery by a foreign application. Can be used when BOINC client can't detect battery type.
- battery_info - battery state for BOINC client
input:
<present>{0/1}</present>
- battery is present
<plugged>{0/1}</plugged>
- device is plugged to power supply
<level>{value in 0..100}</level>
- level of battery
<temperature>{temperature}</temperature>
- temperature
returns:
<success/>
- when success<failed/>
- when failed
modified or introduced sources codes (client directory):
- gui_rpc_server_ops.cpp - rpc requests
- cpu_sched.cpp - changes for cpu scheduler
- client_state.cpp, client_state.h - fixes for main routine
- app.cpp, app.h - applications killing
- app_control.cpp - applications killing
Minor changes
I also performed minor changes in host_info_unix.cpp (detection of extensions and multicore), prefs.* (new Global preferences for battery management), boinc_api (fix bug with suspending of the tasks).
Comments: