Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
svn path=/trunk/boinc/; revision=4962
  • Loading branch information
davidpanderson committed Dec 30, 2004
1 parent b58f9f1 commit 637aa3b
Show file tree
Hide file tree
Showing 21 changed files with 118 additions and 360 deletions.
2 changes: 1 addition & 1 deletion api/boinc_api.C
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#ifdef _WIN32
#include "boinc_win.h"
#include "win_config.h"
#include "version.h"
#else
#include "config.h"
#include <cstdlib>
Expand Down
36 changes: 36 additions & 0 deletions checkin_notes
Original file line number Diff line number Diff line change
Expand Up @@ -21949,3 +21949,39 @@ Bruce 29 Dec 2004
html/
inc/
db_ops.inc

David 29 Dec 2004
- (from James Drews) Add a "don't request more work" request for projects.
Inhibits requesting more work,
but allows completion and reporting of work to continue.
Added a GUI RPC to do this,
and also a menu command in the old Win GUI.
Implemented using a boolean in PROJECT
(saved/restored in client_state.xml)
- Removed win_config.h and win-config.h.
Put all "#ifdef HAVE_*" constructs inside #ifndef _WIN32
Include version.h to get BOINC_MAJOR_VERSION etc.

Now - what exactly are the roles of client/cpp.h and boinc_win.h???

win_config.h (removed)
api/
boinc_api.C
client/
client_types.C,h
cpp.h
cs_scheduler.C
gui_rpc_server.C
win/
boinc_cli.rc
boinc_dll.rc
boinc_gui.h,rc
boinc_ss.rc
wingui_mainwindow.cpp,h
lib/
gui_rpc_client.C,h
gui_test.C
mem_usage.C
win_build/
config.h
win-config.h (removed)
8 changes: 6 additions & 2 deletions client/client_types.C
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void PROJECT::init() {
send_file_list = false;
non_cpu_intensive = false;
suspended_via_gui = false;
dont_request_more_work = false;
#if 0
deletion_policy_priority = false;
deletion_policy_expire = false;
Expand Down Expand Up @@ -184,6 +185,7 @@ int PROJECT::parse_state(MIOFILE& in) {
else if (match_tag(buf, "<send_file_list/>")) send_file_list = true;
else if (match_tag(buf, "<non_cpu_intensive/>")) non_cpu_intensive = true;
else if (match_tag(buf, "<suspended_via_gui/>")) suspended_via_gui = true;
else if (match_tag(buf, "<dont_request_more_work/>")) dont_request_more_work = true;
#if 0
else if (match_tag(buf, "<deletion_policy_priority/>")) deletion_policy_priority = true;
else if (match_tag(buf, "<deletion_policy_expire/>")) deletion_policy_expire = true;
Expand Down Expand Up @@ -235,7 +237,7 @@ int PROJECT::write_state(MIOFILE& out, bool gui_rpc) {
" <min_rpc_time>%f</min_rpc_time>\n"
" <debt>%f</debt>\n"
" <resource_share>%f</resource_share>\n"
"%s%s%s%s%s",
"%s%s%s%s%s%s",
master_url,
project_name,
#if 0
Expand Down Expand Up @@ -265,7 +267,8 @@ int PROJECT::write_state(MIOFILE& out, bool gui_rpc) {
sched_rpc_pending?" <sched_rpc_pending/>\n":"",
send_file_list?" <send_file_list/>\n":"",
non_cpu_intensive?" <non_cpu_intensive/>\n":"",
suspended_via_gui?" <suspended_via_gui/>\n":""
suspended_via_gui?" <suspended_via_gui/>\n":"",
dont_request_more_work?" <dont_request_more_work/>\n":""
);
#if 0
out.printf(
Expand Down Expand Up @@ -328,6 +331,7 @@ void PROJECT::copy_state_fields(PROJECT& p) {
send_file_list = p.send_file_list;
non_cpu_intensive = p.non_cpu_intensive;
suspended_via_gui = p.suspended_via_gui;
dont_request_more_work = p.dont_request_more_work;
#if 0
deletion_policy_priority = p.deletion_policy_priority;
deletion_policy_expire = p.deletion_policy_expire;
Expand Down
5 changes: 4 additions & 1 deletion client/client_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ class PROJECT {
// send the list of permanent files associated/with the project
// in the next scheduler reply
bool suspended_via_gui;

bool dont_request_more_work;
// set the project to only return work and not request more
// for a clean exit to a project, or if a user wants to
// pause doing work for the project
char code_sign_key[MAX_BLOB_LEN];
std::vector<FILE_REF> user_files;
int parse_preferences_for_user_files();
Expand Down
2 changes: 1 addition & 1 deletion client/cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#ifdef _WIN32
#define HOSTTYPE "windows_intelx86"
#include "win_config.h" // version numbers from autoconf
#include "version.h" // version numbers from autoconf
#endif

#ifndef _WIN32
Expand Down
3 changes: 3 additions & 0 deletions client/cs_scheduler.C
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ PROJECT* CLIENT_STATE::next_project_sched_rpc_pending() {
// 1) is eligible for a scheduler RPC
// 2) has work_request > 0
// 3) has master_url_fetch_pending == false
// 4) has dont_request_more_work == false
//
PROJECT* CLIENT_STATE::next_project_need_work(PROJECT *old) {
PROJECT *p;
Expand All @@ -149,6 +150,7 @@ PROJECT* CLIENT_STATE::next_project_need_work(PROJECT *old) {
if (p->master_url_fetch_pending) continue;
if (p->waiting_until_min_rpc_time(now)) continue;
if (p->suspended_via_gui) continue;
if (p->dont_request_more_work) continue;
if (found_old && p->work_request > 0) {
return p;
}
Expand Down Expand Up @@ -391,6 +393,7 @@ int CLIENT_STATE::compute_work_requests() {

p->work_request = 0;
if (p->min_rpc_time >= now) continue;
if (p->dont_request_more_work) continue;

// determine urgency
//
Expand Down
10 changes: 9 additions & 1 deletion client/gui_rpc_server.C
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ static void handle_project_op(char* buf, MIOFILE& fout, char* op) {
} else if (!strcmp(op, "update")) {
p->sched_rpc_pending = true;
p->min_rpc_time = 0;
}
} else if (!strcmp(op, "nomorework")) {
p->dont_request_more_work = true;
} else if (!strcmp(op, "allowmorework")) {
p->dont_request_more_work = false;
}
gstate.must_schedule_cpus = true;
fout.printf("<success/>\n");
}
Expand Down Expand Up @@ -485,6 +489,10 @@ int GUI_RPC_CONN::handle_rpc() {
handle_project_op(request_msg, mf, "resume");
} else if (match_tag(request_msg, "<set_run_mode")) {
handle_set_run_mode(request_msg, mf);
} else if (match_tag(request_msg, "<project_nomorework")) {
handle_project_op(request_msg, mf, "nomorework");
} else if (match_tag(request_msg, "<project_allowmorework")) {
handle_project_op(request_msg, mf, "allowmorework");
} else if (match_tag(request_msg, "<get_run_mode")) {
handle_get_run_mode(request_msg, mf);
} else if (match_tag(request_msg, "<set_network_mode")) {
Expand Down
4 changes: 2 additions & 2 deletions client/win/boinc_cli.rc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "win_config.h"
#include "version.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
Expand Down Expand Up @@ -36,7 +36,7 @@ END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""win_config.h""\r\n"
"#include ""version.h""\r\n"
"\0"
END

Expand Down
4 changes: 2 additions & 2 deletions client/win/boinc_dll.rc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "win_config.h"
#include "version.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
Expand Down Expand Up @@ -36,7 +36,7 @@ END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""win_config.h""\r\n"
"#include ""version.h""\r\n"
"\0"
END

Expand Down
1 change: 1 addition & 0 deletions client/win/boinc_gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
#define ID_FILE_RUN_BENCHMARKS 40044
#define ID_TRANSFERS_RETRYNOW 40045
#define ID_FILE_TOGGLE_NETWORK_ACCESS 40051
#define ID_PROJECT_NOMOREWORK 40060
#define ID_FILE_RUN_REQUEST_ALWAYS 40100
#define ID_FILE_RUN_REQUEST_AUTO 40101
#define ID_FILE_RUN_REQUEST_NEVER 40102
Expand Down
5 changes: 3 additions & 2 deletions client/win/boinc_gui.rc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "win_config.h"
#include "version.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
Expand Down Expand Up @@ -36,7 +36,7 @@ END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""win_config.h""\r\n"
"#include ""version.h""\r\n"
"\0"
END

Expand Down Expand Up @@ -250,6 +250,7 @@ BEGIN
MENUITEM "XXX GET PREFERENCES XXX", ID_PROJECT_GET_PREFS
MENUITEM "&Detach...", ID_PROJECT_DETACH
MENUITEM "&Reset project...", ID_PROJECT_RESET
MENUITEM "XXX NOMOREWORK XXX" ID_PROJECT_NOMOREWORK
END
POPUP "Work"
BEGIN
Expand Down
4 changes: 2 additions & 2 deletions client/win/boinc_ss.rc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "win_config.h"
#include "version.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
Expand Down Expand Up @@ -36,7 +36,7 @@ END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""win_config.h""\r\n"
"#include ""version.h""\r\n"
"\0"
END

Expand Down
24 changes: 24 additions & 0 deletions client/win/wingui_mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ BEGIN_MESSAGE_MAP(CMainWindow, CWnd)
ON_COMMAND(ID_PROJECT_GET_PREFS, OnCommandProjectGetPrefs)
ON_COMMAND(ID_PROJECT_DETACH, OnCommandProjectDetach)
ON_COMMAND(ID_PROJECT_RESET, OnCommandProjectReset)
ON_COMMAND(ID_PROJECT_NOMOREWORK, OnCommandProjectNoMoreWork)
ON_COMMAND(ID_STATUSICON_SHOW, OnCommandShow)
ON_COMMAND(ID_STATUSICON_HIDE, OnCommandHide)
ON_COMMAND(ID_STATUSICON_EXIT, OnCommandExit)
Expand Down Expand Up @@ -250,6 +251,8 @@ CMainWindow::CMainWindow()
m_MenuLabelGetPreferences = "&Update";
m_DialogResetQuery = "Are you sure you want to reset the project %1?";
m_DialogDetachQuery = "Are you sure you want to detach from the project %1?";
m_MenuLabelGetWork = "&Allow new work request";
m_MenuLabelNoMoreWork = "Don't request more work";

// create and position window
CreateEx(0, wndcls.lpszClassName, WND_TITLE,
Expand Down Expand Up @@ -1144,6 +1147,8 @@ void CMainWindow::LoadLanguage()

UpdateLanguageString("MENU-Project", m_MenuLabelGetPreferences, strPath);
UpdateLanguageString("MENU-Project", m_MenuLabelRetryNow, strPath);
UpdateLanguageString("MENU-Project2", m_MenuLabelGetWork, strPath);
UpdateLanguageString("MENU-Project2", m_MenuLabelNoMoreWork, strPath);

UpdateLanguageString("DIALOG-RESET", m_DialogResetQuery, strPath);
UpdateLanguageString("DIALOG-DETACH", m_DialogDetachQuery, strPath);
Expand Down Expand Up @@ -1399,6 +1404,23 @@ void CMainWindow::OnCommandProjectReset()
}
}

// CMainWindow::OnCommandProjectNoMoreWork
// arguments: void
// returns: void
// function: lets the user stop/start work fetches from project
void CMainWindow::OnCommandProjectNoMoreWork (){
PROJECT *proj;
proj = GetProjectFromContextMenu();
if (!proj) return;
if (proj->dont_request_more_work) {
proj->dont_request_more_work = false;
show_message(proj,"Allowing more work to be requested from project",MSG_INFO);
} else {
proj->dont_request_more_work = true;
show_message(proj,"Won't request any more work from project",MSG_INFO);
}
}

//////////
// CMainWindow::OnCommandWorkShowGraphics
// arguments: void
Expand Down Expand Up @@ -1973,6 +1995,8 @@ void CMainWindow::OnRButtonDown(UINT nFlags, CPoint point)
pContextMenu->ModifyMenu(ID_PROJECT_GET_PREFS, 0, ID_PROJECT_GET_PREFS,
((proj && proj->min_rpc_time > dtime()) ?
m_MenuLabelRetryNow : m_MenuLabelGetPreferences));
pContextMenu->ModifyMenu(ID_PROJECT_NOMOREWORK, 0, ID_PROJECT_NOMOREWORK,
(proj->dont_request_more_work?m_MenuLabelGetWork:m_MenuLabelNoMoreWork));
break;
}
case RESULT_MENU:
Expand Down
2 changes: 2 additions & 0 deletions client/win/wingui_mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class CMainWindow : public CWnd
afx_msg void OnCommandProjectGetPrefs();
afx_msg void OnCommandProjectDetach();
afx_msg void OnCommandProjectReset();
afx_msg void OnCommandProjectNoMoreWork();
afx_msg void OnCommandWorkShowGraphics();
afx_msg void OnCommandTransfersRetryNow();
afx_msg void OnCommandFileClearInactive();
Expand Down Expand Up @@ -187,6 +188,7 @@ class CMainWindow : public CWnd

CString m_MenuLabelRetryNow, m_MenuLabelGetPreferences;
CString m_DialogResetQuery, m_DialogDetachQuery;
CString m_MenuLabelGetWork, m_MenuLabelNoMoreWork;

DECLARE_MESSAGE_MAP()

Expand Down
17 changes: 13 additions & 4 deletions lib/gui_rpc_client.C
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#ifdef _WIN32
#include "boinc_win.h"
#include "version.h"
#include "win_config.h"
#endif

#ifndef _WIN32
Expand Down Expand Up @@ -110,6 +109,10 @@ int PROJECT::parse(MIOFILE& in) {
suspended_via_gui = true;
continue;
}
else if (match_tag(buf, "<dont_request_more_work/>")) {
dont_request_more_work = true;
continue;
}
else if (match_tag(buf, "<tentative/>")) {
tentative = true;
continue;
Expand Down Expand Up @@ -149,6 +152,7 @@ void PROJECT::print() {
printf(" scheduler RPC pending: %s\n", sched_rpc_pending?"yes":"no");
printf(" tentative: %s\n", tentative?"yes":"no");
printf(" suspended via GUI: %s\n", suspended_via_gui?"yes":"no");
printf(" don't request more work: %s\n", dont_request_more_work?"yes":"no");
for (i=0; i<gui_urls.size(); i++) {
gui_urls[i].print();
}
Expand All @@ -172,6 +176,7 @@ void PROJECT::clear() {
sched_rpc_pending = false;
tentative = false;
suspended_via_gui = false;
dont_request_more_work = false;
gui_urls.clear();
}

Expand Down Expand Up @@ -896,7 +901,7 @@ void RPC_CLIENT::close() {
#else
::close(sock);
#endif
sock = 0;
sock = 0;
}

int RPC_CLIENT::init(const char* host) {
Expand Down Expand Up @@ -931,7 +936,7 @@ int RPC_CLIENT::init(const char* host) {
printf( "Windows Socket Error '%d'\n", WSAGetLastError() );
#endif
perror("connect");
close();
close();
return ERR_CONNECT;
}
return 0;
Expand Down Expand Up @@ -982,7 +987,7 @@ RPC::~RPC() {
int RPC::do_rpc(char* req) {
int retval;

if (rpc_client->sock == 0) return ERR_CONNECT;
if (rpc_client->sock == 0) return ERR_CONNECT;
retval = rpc_client->send_request(req);
if (retval) return retval;
retval = rpc_client->get_reply(mbuf);
Expand Down Expand Up @@ -1173,6 +1178,10 @@ int RPC_CLIENT::project_op(PROJECT& project, char* op) {
tag = "project_suspend";
} else if (!strcmp(op, "resume")) {
tag = "project_resume";
} else if (!strcmp(op, "allowmorework")) {
tag = "project_allowmorework";
} else if (!strcmp(op, "nomorework")) {
tag = "project_nomorework";
} else {
return -1;
}
Expand Down
Loading

0 comments on commit 637aa3b

Please sign in to comment.