Skip to content

Commit

Permalink
- client: fix bugs when writing/parsing cc_config.xml via GUI RPCs
Browse files Browse the repository at this point in the history
    (e.g. when editing it via the Manager).
    Include only the GPUs that were specified in the original cc_config.xml,
    not those detected by the client.
- client: fix bug that failed to require authorization for
    GUI RPCs that are supposed to be authorized
- client: report parse errors in acct_mgr_url.xml and acct_mgr_login.xml
- fix compile warnings
- user web: in sample project_specific_prefs.inc,
    get app names from the DB instead of listing them in the PHP code.


svn path=/trunk/boinc/; revision=24518
  • Loading branch information
davidpanderson committed Nov 3, 2011
1 parent 8385953 commit ad2f377
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 22 deletions.
25 changes: 25 additions & 0 deletions checkin_notes
Original file line number Diff line number Diff line change
Expand Up @@ -8030,3 +8030,28 @@ Charlie 3 Nov 2011
GR-ReadMe.rtf
PTP-ReadMe.rtf
ReadMe.rtf

David 3 Nov 2011
- client: fix bugs when writing/parsing cc_config.xml via GUI RPCs
(e.g. when editing it via the Manager).
Include only the GPUs that were specified in the original cc_config.xml,
not those detected by the client.
- client: fix bug that failed to require authorization for
GUI RPCs that are supposed to be authorized
- client: report parse errors in acct_mgr_url.xml and acct_mgr_login.xml
- fix compile warnings
- user web: in sample project_specific_prefs.inc,
get app names from the DB instead of listing them in the PHP code.

html/project.sample/
project_specific_prefs.inc
lib/
coproc.h
cc_config.cpp
client/
switcher.cpp
coproc_detect.cpp
gui_rpc_server_ops.cpp
acct_mgr.cpp
app.cpp
cpu_sched.cpp
12 changes: 11 additions & 1 deletion client/acct_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,11 +745,16 @@ int ACCT_MGR_INFO::parse_login_file(FILE* p) {
else if (xp.parse_double("next_rpc_time", next_rpc_time)) continue;
else if (xp.match_tag("opaque")) {
retval = xp.element_contents("</opaque>", opaque, sizeof(opaque));
if (retval) {
msg_printf(NULL, MSG_INFO,
"error parsing <opaque> in acct_mgr_login.xml"
);
}
continue;
}
if (log_flags.unparsed_xml) {
msg_printf(NULL, MSG_INFO,
"[unparsed_xml] ACCT_MGR_INFO::parse_login: unrecognized %s",
"[unparsed_xml] unrecognized %s in acct_mgr_login.xml",
xp.parsed_tag
);
}
Expand Down Expand Up @@ -784,6 +789,11 @@ int ACCT_MGR_INFO::init() {
else if (xp.parse_bool("send_gui_rpc_info", send_gui_rpc_info)) continue;
else if (xp.match_tag("signing_key")) {
retval = xp.element_contents("</signing_key>", signing_key, sizeof(signing_key));
if (retval) {
msg_printf(NULL, MSG_INFO,
"error parsing <signing_key> in acct_mgr_url.xml"
);
}
continue;
}
else if (xp.parse_bool("cookie_required", cookie_required)) continue;
Expand Down
5 changes: 2 additions & 3 deletions client/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ ACTIVE_TASK::ACTIVE_TASK() {
// and ACTIVE_TASK_SET::suspend_all()
//
int ACTIVE_TASK::preempt(int preempt_type) {
int retval;
bool remove=false;

switch (preempt_type) {
Expand Down Expand Up @@ -164,15 +163,15 @@ int ACTIVE_TASK::preempt(int preempt_type) {
result->name
);
}
retval = request_exit();
return request_exit();
} else {
if (log_flags.cpu_sched) {
msg_printf(result->project, MSG_INFO,
"[cpu_sched] Preempting %s (left in memory)",
result->name
);
}
retval = suspend();
return suspend();
}
return 0;
}
Expand Down
2 changes: 0 additions & 2 deletions client/coproc_detect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,12 +1098,10 @@ void COPROC_ATI::get(
vector<string>& descs, vector<string>& warnings, vector<int>& ignore_devs
) {
CALuint numDevices, cal_major, cal_minor, cal_imp;
CALdevice device;
char buf[256];
int retval;

attribs.struct_size = sizeof(CALdeviceattribs);
device = 0;
numDevices =0;

#ifdef _WIN32
Expand Down
2 changes: 0 additions & 2 deletions client/cpu_sched.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1445,12 +1445,10 @@ static inline void assign_coprocs(vector<RESULT*>& jobs) {
bool CLIENT_STATE::enforce_run_list(vector<RESULT*>& run_list) {
unsigned int i;
vector<ACTIVE_TASK*> preemptable_tasks;
static double last_time = 0;
int retval;
double ncpus_used=0, ncpus_used_non_gpu=0;
ACTIVE_TASK* atp;

last_time = now;
bool action = false;

#ifndef SIM
Expand Down
2 changes: 1 addition & 1 deletion client/gui_rpc_server_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ struct GUI_RPC {
strcpy(alt_req_tag, req);
strcat(alt_req_tag, "/");
handler = h;
ar = auth_required;
auth_required = ar;
enable_network = en;
read_only = ro;
}
Expand Down
2 changes: 1 addition & 1 deletion client/switcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

using std::strcpy;

int main(int argc, char** argv) {
int main(int /*argc*/, char** argv) {
passwd *pw;
group *grp;
char user_name[256], group_name[256];
Expand Down
9 changes: 5 additions & 4 deletions html/project.sample/project_specific_prefs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ define('ACCEPT_ANY_DESC', tra('If no work for selected applications is available
// which means that if the project adds a new app such users will run it also.
//
if (APP_SELECT_PREFS) {
$app_array = array(
array(1, "Application one"),
array(2, "Application two"),
);
$app_array = array();
$apps = BoincApp::enum("deprecated=0");
foreach($apps as $app) {
$app_array[] = array($app->id, $app->user_friendly_name);
}
} else {
$app_array = null;
}
Expand Down
19 changes: 11 additions & 8 deletions lib/cc_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,9 @@ int CONFIG::parse_options(XML_PARSER& xp) {
if (xp.match_tag("coproc")) {
COPROC c;
retval = c.parse(xp);
c.specified_in_config = true;
if (retval) return retval;
if (!strcmp(c.type, "CPU")) continue;
retval = config_coprocs.add(c);
if (retval) return retval;
continue;
Expand Down Expand Up @@ -423,8 +425,8 @@ int CONFIG::parse(XML_PARSER& xp, LOG_FLAGS& log_flags) {
}

int CONFIG::write(MIOFILE& out, LOG_FLAGS& log_flags) {
unsigned int i;
int j;
unsigned int i;

out.printf("<set_cc_config>\n");
out.printf("<cc_config>\n");
Expand Down Expand Up @@ -455,20 +457,21 @@ int CONFIG::write(MIOFILE& out, LOG_FLAGS& log_flags) {
client_download_url.c_str()
);

for (i=0; i<(unsigned int)config_coprocs.n_rsc; ++i) {
for (int k=1; k<config_coprocs.n_rsc; k++) {
if (!config_coprocs.coprocs[k].specified_in_config) continue;
out.printf(
" <coproc>\n"
" <type>%s</type>\n"
" <count>%d</count>\n"
" <peak_flops>%f</peak_flops>\n"
" <device_nums>",
config_coprocs.coprocs[i].type,
config_coprocs.coprocs[i].count,
config_coprocs.coprocs[i].peak_flops
config_coprocs.coprocs[k].type,
config_coprocs.coprocs[k].count,
config_coprocs.coprocs[k].peak_flops
);
for (j=0; j<config_coprocs.coprocs[i].count; ++i) {
out.printf("%d", config_coprocs.coprocs[i].device_nums[j]);
if (j < (config_coprocs.coprocs[i].count - 1)) {
for (j=0; j<config_coprocs.coprocs[k].count; j++) {
out.printf("%d", config_coprocs.coprocs[k].device_nums[j]);
if (j < (config_coprocs.coprocs[k].count - 1)) {
out.printf(" ");
}
}
Expand Down
9 changes: 9 additions & 0 deletions lib/coproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ struct COPROC {
bool have_cal; // True if this GPU supports CAL on this computer
bool have_opencl; // True if this GPU supports openCL on this computer
double available_ram;
bool specified_in_config;
// If true, this coproc was listed in cc_config.xml
// rather than being detected by the client.

// the following are used in both client and server for work-fetch info
//
Expand Down Expand Up @@ -202,6 +205,7 @@ struct COPROC {
have_cuda = false;
have_cal = false;
have_opencl = false;
specified_in_config = false;
available_ram = -1;
req_secs = 0;
req_instances = 0;
Expand Down Expand Up @@ -398,6 +402,11 @@ struct COPROCS {
}
int add(COPROC& c) {
if (n_rsc >= MAX_RSC) return ERR_BUFFER_OVERFLOW;
for (int i=1; i<n_rsc; i++) {
if (!strcmp(c.type, coprocs[i].type)) {
return ERR_DUP_NAME;
}
}
coprocs[n_rsc++] = c;
return 0;
}
Expand Down

0 comments on commit ad2f377

Please sign in to comment.