mirror of https://github.com/BOINC/boinc.git
API: Add executing_as_daemon bool to get_state rpc. SCR: When running V5 GFX applications as a service / daemon, display appropriate error message instead of trying to display graphics.
svn path=/trunk/boinc/; revision=14641
This commit is contained in:
parent
acbd32a04e
commit
167da5c015
|
@ -907,3 +907,20 @@ David Jan 29 2008
|
|||
clientgui/
|
||||
DlgAdvPreferences.cpp
|
||||
DlgAdvPreferencesBase.cpp
|
||||
|
||||
Charlie Jan 29 2008
|
||||
- SCR: When running V5 GFX applications as a service / daemon, display
|
||||
appropriate error message instead of trying to display graphics.
|
||||
- API: Add executing_as_daemon bool to get_state rpc.
|
||||
|
||||
client/
|
||||
cs_statefile.C
|
||||
clientscr/
|
||||
boinc_ss.rc
|
||||
mac_saver_module.cpp,h
|
||||
Mac_Saver_Module.h
|
||||
screensaver.cpp
|
||||
screensaver_win.h
|
||||
lib/
|
||||
gui_rpc_client.h
|
||||
gui_rpc_client_ops.C
|
||||
|
|
|
@ -779,11 +779,13 @@ int CLIENT_STATE::write_state_gui(MIOFILE& f) {
|
|||
"<core_client_major_version>%d</core_client_major_version>\n"
|
||||
"<core_client_minor_version>%d</core_client_minor_version>\n"
|
||||
"<core_client_release>%d</core_client_release>\n"
|
||||
"%s"
|
||||
"%s",
|
||||
get_primary_platform(),
|
||||
core_client_version.major,
|
||||
core_client_version.minor,
|
||||
core_client_version.release,
|
||||
executing_as_daemon?"<executing_as_daemon/>\n":"",
|
||||
work_fetch_no_new_work?"<work_fetch_no_new_work/>\n":""
|
||||
);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ protected:
|
|||
pid_t FindProcessPID(char* name, pid_t thePID);
|
||||
OSErr GetpathToBOINCManagerApp(char* path, int maxLen);
|
||||
bool SetError( bool bErrorMode, unsigned int hrError );
|
||||
void UpdateProgressText();
|
||||
void UpdateProgressText(unsigned int hrError);
|
||||
void setBannerText(const char *msg, GrafPtr aPort);
|
||||
void updateBannerText(char *msg, GrafPtr aPort);
|
||||
void drawBanner(GrafPtr aPort);
|
||||
|
@ -119,6 +119,7 @@ protected:
|
|||
|
||||
bool m_bResetCoreState;
|
||||
bool m_QuitDataManagementProc;
|
||||
bool m_bV5_GFX_app_is_running;
|
||||
|
||||
|
||||
//
|
||||
|
|
|
@ -119,7 +119,7 @@ BEGIN
|
|||
VALUE "FileDescription", "BOINC Screensaver"
|
||||
VALUE "FileVersion", BOINC_VERSION_STRING "\0"
|
||||
VALUE "InternalName", "boinc_ss"
|
||||
VALUE "LegalCopyright", "Copyright © 2003-2007 University of California"
|
||||
VALUE "LegalCopyright", "Copyright <EFBFBD> 2003-2007 University of California"
|
||||
VALUE "OriginalFilename", "boinc.scr"
|
||||
VALUE "ProductName", "BOINC client"
|
||||
VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
|
||||
|
@ -154,7 +154,7 @@ BEGIN
|
|||
VALUE "FileDescription", "BOINC Screensaver"
|
||||
VALUE "FileVersion", BOINC_VERSION_STRING "\0"
|
||||
VALUE "InternalName", "boinc_ss"
|
||||
VALUE "LegalCopyright", "© 2003-2007 University of California"
|
||||
VALUE "LegalCopyright", "<EFBFBD> 2003-2007 University of California"
|
||||
VALUE "OriginalFilename", "boinc.scr"
|
||||
VALUE "ProductName", "BOINC client"
|
||||
VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
|
||||
|
@ -189,7 +189,7 @@ BEGIN
|
|||
VALUE "FileDescription", "BOINC Screensaver"
|
||||
VALUE "FileVersion", BOINC_VERSION_STRING "\0"
|
||||
VALUE "InternalName", "boinc_ss"
|
||||
VALUE "LegalCopyright", "© 2003-2007 University of California"
|
||||
VALUE "LegalCopyright", "<EFBFBD> 2003-2007 University of California"
|
||||
VALUE "OriginalFilename", "boinc.scr"
|
||||
VALUE "ProductName", "BOINC client"
|
||||
VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
|
||||
|
@ -224,7 +224,7 @@ BEGIN
|
|||
VALUE "FileDescription", "BOINC Screensaver"
|
||||
VALUE "FileVersion", BOINC_VERSION_STRING "\0"
|
||||
VALUE "InternalName", "boinc_ss"
|
||||
VALUE "LegalCopyright", "© 2003-2007 University of California"
|
||||
VALUE "LegalCopyright", "<EFBFBD> 2003-2007 University of California"
|
||||
VALUE "OriginalFilename", "boinc.scr"
|
||||
VALUE "ProductName", "BOINC client"
|
||||
VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
|
||||
|
@ -309,7 +309,7 @@ BEGIN
|
|||
IDS_ERR_BOINCSHUTDOWNEVENT
|
||||
"Gridrepublic screensaver shutting down."
|
||||
IDS_ERR_DAEMONALLOWSNOGRAPHICS
|
||||
"Gridrepublic screensaver graphics\ndisabled.\n\nGraphics cannot be displayed when configured to run\nas a Windows service."
|
||||
"Gridrepublic screensaver cannot display graphics \nfrom older applications when configured to \nrun as a Windows service."
|
||||
END
|
||||
|
||||
#elif defined(_WCG)
|
||||
|
@ -334,6 +334,8 @@ BEGIN
|
|||
"Application found, graphics loading...\n\nPlease wait..."
|
||||
IDS_ERR_BOINCSHUTDOWNEVENT
|
||||
"World Community Grid\nscreensaver shutting down."
|
||||
IDS_ERR_DAEMONALLOWSNOGRAPHICS
|
||||
"World Community Grid screensaver cannot display graphics \nfrom older applications when configured to \nrun as a Windows service."
|
||||
END
|
||||
|
||||
#elif defined(_SEED)
|
||||
|
@ -358,6 +360,8 @@ BEGIN
|
|||
"Application found, graphics loading...\n\nPlease wait..."
|
||||
IDS_ERR_BOINCSHUTDOWNEVENT
|
||||
"seedmagazine\nscreensaver shutting down."
|
||||
IDS_ERR_DAEMONALLOWSNOGRAPHICS
|
||||
"seedmagazine screensaver cannot display graphics \nfrom older applications when configured to \nrun as a Windows service."
|
||||
END
|
||||
|
||||
#else
|
||||
|
@ -383,7 +387,7 @@ BEGIN
|
|||
IDS_ERR_BOINCSHUTDOWNEVENT
|
||||
"BOINC screensaver shutting down."
|
||||
IDS_ERR_DAEMONALLOWSNOGRAPHICS
|
||||
"BOINC screensaver graphics disabled.\n\nGraphics cannot be displayed when configured to run\nas a Windows service."
|
||||
"BOINC screensaver cannot display graphics \nfrom older applications when configured to \nrun as a Windows service."
|
||||
END
|
||||
|
||||
#endif
|
||||
|
|
|
@ -110,6 +110,8 @@ const char * BOINCNoProjectsDetectedMsg = "BOINC is not attached to any project
|
|||
const char * BOINCNoGraphicAppsExecutingMsg = "Project does not support screensaver graphics: ";
|
||||
const char * BOINCUnrecoverableErrorMsg = "Sorry, an unrecoverable error occurred";
|
||||
const char * BOINCTestmodeMsg = "BOINC screensaver is running, but cannot display graphics in test mode.";
|
||||
const char * BOINCV5GFXDaemonMsg = "BOINC can't display graphics from older applications when running as a daemon.";
|
||||
|
||||
//const char * BOINCExitedSaverMode = "BOINC is no longer in screensaver mode.";
|
||||
|
||||
|
||||
|
@ -368,6 +370,7 @@ int CScreensaver::drawGraphics(GrafPtr aPort) {
|
|||
break;
|
||||
#endif
|
||||
case SCRAPPERR_BOINCNOGRAPHICSAPPSEXECUTING:
|
||||
case SCRAPPERR_DAEMONALLOWSNOGRAPHICS:
|
||||
if (m_StatusMessageUpdated) {
|
||||
setBannerText(m_MsgBuf, aPort);
|
||||
updateBannerText(m_MsgBuf, aPort);
|
||||
|
@ -508,17 +511,18 @@ bool CScreensaver::SetError(bool bErrorMode, unsigned int hrError) {
|
|||
m_bErrorMode = bErrorMode;
|
||||
m_hrError = hrError;
|
||||
if ((hrError == SCRAPPERR_BOINCNOGRAPHICSAPPSEXECUTING)
|
||||
|| (hrError == SCRAPPERR_DAEMONALLOWSNOGRAPHICS)
|
||||
#if ALWAYS_DISPLAY_PROGRESS_TEXT
|
||||
|| (hrError == SCRAPPERR_SCREENSAVERRUNNING)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
UpdateProgressText();
|
||||
UpdateProgressText(hrError);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CScreensaver::UpdateProgressText() {
|
||||
void CScreensaver::UpdateProgressText(unsigned int hrError) {
|
||||
int iResultCount;
|
||||
int iIndex;
|
||||
unsigned int len;
|
||||
|
@ -530,7 +534,9 @@ void CScreensaver::UpdateProgressText() {
|
|||
if ( (m_statusUpdateCounter >= (STATUSUPDATEINTERVAL * BANNERFREQUENCY) ) && !m_updating_results ) {
|
||||
if (! m_StatusMessageUpdated) {
|
||||
m_statusUpdateCounter = 0;
|
||||
strcpy(m_MsgBuf, BOINCNoGraphicAppsExecutingMsg);
|
||||
strcpy(m_MsgBuf, hrError == SCRAPPERR_DAEMONALLOWSNOGRAPHICS ?
|
||||
BOINCV5GFXDaemonMsg : BOINCNoGraphicAppsExecutingMsg
|
||||
);
|
||||
|
||||
iResultCount = results.results.size();
|
||||
theResult = NULL;
|
||||
|
|
|
@ -61,6 +61,7 @@ bool CScreensaver::is_same_task(RESULT* taska, RESULT* taskb) {
|
|||
int CScreensaver::count_active_graphic_apps(RESULTS& results, RESULT* exclude) {
|
||||
unsigned int i = 0;
|
||||
unsigned int graphics_app_count = 0;
|
||||
m_bV5_GFX_app_is_running = false;
|
||||
|
||||
// Count the number of active graphics-capable apps excluding the specified result.
|
||||
// If exclude is NULL, don't exclude any results.
|
||||
|
@ -70,8 +71,9 @@ int CScreensaver::count_active_graphic_apps(RESULTS& results, RESULT* exclude) {
|
|||
_T("get_random_graphics_app -- name = '%s', path = '%s'\n"),
|
||||
results.results[i]->name.c_str(), results.results[i]->graphics_exec_path.c_str()
|
||||
);
|
||||
if (results.results[i]->supports_graphics) m_bV5_GFX_app_is_running = true;
|
||||
if ((results.results[i]->graphics_exec_path.size() == 0)
|
||||
&& (!(results.results[i]->supports_graphics))) continue;
|
||||
&& (state.executing_as_daemon || !(results.results[i]->supports_graphics))) continue;
|
||||
BOINCTRACE(_T("get_random_graphics_app -- active task detected w/graphics\n"));
|
||||
|
||||
if (is_same_task(results.results[i], exclude)) continue;
|
||||
|
@ -116,7 +118,7 @@ RESULT* CScreensaver::get_random_graphics_app(RESULTS& results, RESULT* exclude)
|
|||
// Lets find the chosen graphics application.
|
||||
for (i = 0; i < results.results.size(); i++) {
|
||||
if ((results.results[i]->graphics_exec_path.size() == 0)
|
||||
&& (!(results.results[i]->supports_graphics))) continue;
|
||||
&& (state.executing_as_daemon || !(results.results[i]->supports_graphics))) continue;
|
||||
if (is_same_task(results.results[i], avoid)) continue;
|
||||
|
||||
current_counter++;
|
||||
|
@ -474,7 +476,9 @@ void *CScreensaver::DataManagementProc() {
|
|||
SetError(TRUE, SCRAPPERR_BOINCNOAPPSEXECUTING);
|
||||
} else {
|
||||
// We currently do not have any graphics capable application
|
||||
SetError(TRUE, SCRAPPERR_BOINCNOGRAPHICSAPPSEXECUTING);
|
||||
SetError(TRUE, m_bV5_GFX_app_is_running ?
|
||||
SCRAPPERR_DAEMONALLOWSNOGRAPHICS : SCRAPPERR_BOINCNOGRAPHICSAPPSEXECUTING
|
||||
);
|
||||
}
|
||||
}
|
||||
} else { // End if ((m_hGraphicsApplication == 0) && (graphics_app_result_ptr == NULL))
|
||||
|
|
|
@ -184,6 +184,7 @@ protected:
|
|||
HANDLE m_hGraphicsApplication;
|
||||
BOOL m_bResetCoreState;
|
||||
bool m_QuitDataManagementProc;
|
||||
bool m_bV5_GFX_app_is_running;
|
||||
int m_iLastResultShown;
|
||||
time_t m_tLastResultChangeTime;
|
||||
time_t m_tThreadCreateTime;
|
||||
|
|
|
@ -309,6 +309,7 @@ public:
|
|||
|
||||
GLOBAL_PREFS global_prefs; // working prefs, i.e. network + override
|
||||
VERSION_INFO version_info; // populated only if talking to pre-5.6 CC
|
||||
bool executing_as_daemon; // true if Client is running as a service / daemon
|
||||
|
||||
CC_STATE();
|
||||
~CC_STATE();
|
||||
|
|
|
@ -608,6 +608,7 @@ void CC_STATE::clear() {
|
|||
delete results[i];
|
||||
}
|
||||
results.clear();
|
||||
executing_as_daemon = false;
|
||||
}
|
||||
|
||||
PROJECT* CC_STATE::lookup_project(string& str) {
|
||||
|
@ -1065,6 +1066,7 @@ int RPC_CLIENT::get_state(CC_STATE& state) {
|
|||
if (parse_int(buf, "<major_version>", state.version_info.major)) continue;
|
||||
if (parse_int(buf, "<minor_version>", state.version_info.minor)) continue;
|
||||
if (parse_int(buf, "<release>", state.version_info.release)) continue;
|
||||
if (parse_bool(buf, "executing_as_daemon", state.executing_as_daemon)) continue;
|
||||
if (match_tag(buf, "<project>")) {
|
||||
project = new PROJECT();
|
||||
project->parse(rpc.fin);
|
||||
|
|
Loading…
Reference in New Issue