diff --git a/checkin_notes b/checkin_notes index d98d2415eb..df4ba01643 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2734,3 +2734,24 @@ David 9 Mar 2006 client/ cs_scheduler.C + +David 9 Mar 2006 + - user web: minor fixes + + html/user/ + debug.php (removed) + profile_search_action.php + user_search_action.php + +David 9 Mar 2006 + - Scheduler: avoid creating redundant host records. + If a scheduler request has zero host ID but non-blank host CPID, + see if there's a host record in the DB with that CPID; + if so, pick the most recent (i.e. largest ID) + and use it (rather than creating a new host record). + + This change means that when you detach/reattach to a project, + you won't get a new host record. Woo hoo! + + sched/ + handle_request.C diff --git a/client/cs_scheduler.C b/client/cs_scheduler.C index f5f3227fcd..472b6da186 100644 --- a/client/cs_scheduler.C +++ b/client/cs_scheduler.C @@ -1190,13 +1190,13 @@ void CLIENT_STATE::scale_duration_correction_factors(double factor) { } // Choose a new host CPID. -// If using account manager, -// do scheduler RPCs to all projects to propagate the CPID +// If using account manager, do scheduler RPCs +// to all acct-mgr-attached projects to propagate the CPID // void CLIENT_STATE::generate_new_host_cpid() { host_info.generate_host_cpid(); - if (strlen(acct_mgr_info.acct_mgr_url)) { - for (unsigned int i=0; iattached_via_acct_mgr) { projects[i]->sched_rpc_pending = true; projects[i]->min_rpc_time = now + 15; } diff --git a/doc/boinc_news.inc b/doc/boinc_news.inc index a39b85fad0..310e7fb087 100644 --- a/doc/boinc_news.inc +++ b/doc/boinc_news.inc @@ -11,9 +11,9 @@ array("March 5, 2006", array("March 3, 2006", "Quantum Monte Carlo at Home announces the public release of the first chemistry BOINC project. - This project studies the structure and reactivity of molecules - using Quantum Chemistry, whose vastly complex equations - require huge amounts of computing power. + This project, based at the University of Münster in Germany, + studies the structure and reactivity of molecules using Quantum Chemistry, + whose vastly complex equations require huge amounts of computing power. " ), array("February 24, 2006", diff --git a/html/user/debug.php b/html/user/debug.php deleted file mode 100644 index 60773e1655..0000000000 --- a/html/user/debug.php +++ /dev/null @@ -1,44 +0,0 @@ -Download debugging files -

- Windows users: -

- If the BOINC application crashes, it is very helpful if you mail us the stack trace - (which shows exactly where the crash occurred). - To do this, you will need to have the symbol file on your computer. -

- BOINC core client -

- The zipped symbol file(s) are for the BOINC core client 2.25 - (both GUI and CLI versions) are here: - boinc_225_pdb.zip -

- Place the extracted file(s) in the same directory as the executable(s) - (usually C:/Program Files/BOINC). -

-

-

Sending Debug Results

-

- The files we are interested in are user.dmp and drwtsn32.log, they can be found in the Dr. Watson folder - (usually C:/Documents and Settings/All Users/Application Data/Dr Watson). -

- We would perfer the files to be zipped up with a compression program like winzip or gzip. -

- Be sure to include which version of BOINC and the project applications you are using in the email. -

- Thanks for helping make BOINC a better product. -

-

-"; - - page_tail(); -?> diff --git a/html/user/profile_search_action.php b/html/user/profile_search_action.php index 3907403ce6..c4c424fef1 100644 --- a/html/user/profile_search_action.php +++ b/html/user/profile_search_action.php @@ -10,8 +10,8 @@ function show_profile_link($profile, $n) { db_init(); -$search_string = $_GET['search_string']; -$offset = $_GET['offset']; +$search_string = get_str('search_string'); +$offset = get_int('offset', true); if (!$offset) $offset=0; $count = 10; diff --git a/html/user/user_search_action.php b/html/user/user_search_action.php index b0de4d88c5..7d7d702412 100644 --- a/html/user/user_search_action.php +++ b/html/user/user_search_action.php @@ -60,9 +60,7 @@ $default_sort = 'id'; $allowed_order = array('id', 'name', 'create_time','country', 'total_credit', 'expavg_credit'); $nice_names = array('', 'sorted by name', 'sorted by date joined', 'sorted by country', 'sorted by total credit', 'sorted by recent average credit'); -/* Sanity check on order */ -if (!isset ($_GET['order']) || - !in_array ($_GET['order'], $allowed_order)) { +if (!isset ($_GET['order']) || !in_array ($_GET['order'], $allowed_order)) { $order = $default_sort; $nice_name=''; } else { @@ -70,7 +68,7 @@ if (!isset ($_GET['order']) || $nice_name = $nice_names[array_search($order, $allowed_order)]; } -if (isset($_GET['search_string'])) $search_string = $_GET['search_string']; +$search_string = get_str('search_string'); if (isset($_GET['offset'])) $offset = $_GET['offset']; if (!is_numeric($offset) || $offset<0) $offset=0; @@ -91,8 +89,7 @@ page_head("Search results"); if (strlen($search_string)>=3) { $urls = urlencode($search_string); - $s = str_replace('_', '\\\\_', $search_string); - $s = str_replace('%', '\\\\%', $s); + $s = escape_pattern($search_string); $q = "select * from user where name like '$s%' order by $order $upordown limit $offset,$count"; $result = mysql_query($q); diff --git a/sched/handle_request.C b/sched/handle_request.C index eb964b1e4f..46eff8a2e2 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -108,6 +108,23 @@ void unlock_sched(SCHEDULER_REPLY& reply) { close(reply.lockfile_fd); } +// find the user's most recent host with given host CPID +// +bool find_host_by_cpid(DB_USER& user, char* host_cpid, DB_HOST& host) { + char buf[256], buf2[256]; + sprintf(buf, "%s%s", host_cpid, user.email_addr); + md5_block((const unsigned char*)buf, strlen(buf), buf2); + + sprintf(buf, + "where userid=%d and host_cpid='%s' order by id desc", user.id, buf2 + ); + if (!host.enumerate(buf)) { + host.end_enumerate(); + return true; + } + return false; +} + // Based on the info in the request message, // look up the host and its user, and make sure the authenticator matches. // Some special cases: @@ -118,7 +135,7 @@ void unlock_sched(SCHEDULER_REPLY& reply) { // then follow links to find the proper host // // POSTCONDITION: -// If this returns zero, then: +// If this function returns zero, then: // - reply.host contains a valid host record (possibly new) // - reply.user contains a valid user record // - if user belongs to a team, reply.team contains team record @@ -165,8 +182,7 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { ); strlcpy( - user.authenticator, sreq.authenticator, - sizeof(user.authenticator) + user.authenticator, sreq.authenticator, sizeof(user.authenticator) ); sprintf(buf, "where authenticator='%s'", user.authenticator); retval = user.lookup(buf); @@ -215,8 +231,8 @@ int authenticate_user(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { goto make_new_host; } } else { - - // here no hostid was given; we'll have to create a new host record + // Here no hostid was given, or the ID was bad. + // Look up the user, then create a new host record // lookup_user_and_make_new_host: strlcpy( @@ -241,7 +257,25 @@ lookup_user_and_make_new_host: return ERR_AUTHENTICATOR; } reply.user = user; + + // If host CPID is present, + // scan backwards through this user's hosts, + // looking for one with the same host CPID. + // If we find one, it means the user detached and reattached. + // Use the existing host record. + // + if (strlen(sreq.host.host_cpid)) { + if (find_host_by_cpid(user, sreq.host.host_cpid, host)) { + goto got_host; + } + } + make_new_host: + // either of the above cases, + // or host ID didn't match user ID, + // or RPC seqno was too low. + // + // Create a new host. // reply.user is filled in and valid at this point // host = sreq.host; @@ -262,6 +296,7 @@ make_new_host: } host.id = boinc_db.insert_id(); +got_host: reply.host = host; reply.hostid = reply.host.id; // this tells client to updates its host ID @@ -287,7 +322,7 @@ make_new_host: reply.email_hash ); - // see if new cross-project ID + // if new user CPID, update user record // if (strlen(sreq.cross_project_id)) { if (strcmp(sreq.cross_project_id, reply.user.cross_project_id)) {