diff --git a/checkin_notes b/checkin_notes index 688d4aaeea..6de136f88f 100755 --- a/checkin_notes +++ b/checkin_notes @@ -11558,3 +11558,14 @@ Bruce 9 Sept 2005 Rom 9 Sept 2005 (staging) - Tag for 5.1.3 release, all platforms boinc_core_release_5_1_3 + +David 9 Sept 2005 + - fix web bug, make zip code optional + - add some comments + + client/ + client_state.C + html/user/ + account_finish_action.php + lib/ + util.C diff --git a/client/client_state.C b/client/client_state.C index 2beb6280b2..69fe4f456c 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -402,8 +402,15 @@ void CLIENT_STATE::do_io_or_sleep(double x) { &tv ); //printf("select in %d out %d\n", all_fds.max_fd, n); + + // Note: curl apparently likes to have curl_multi_perform() + // (called from net_xfers->got_select()) + // called pretty often, even if no descriptors are enabled. + // So do the "if (n==0) break" AFTER the got_selects(). + net_xfers->got_select(all_fds, x); gui_rpcs.got_select(all_fds); + if (n==0) break; now = dtime(); diff --git a/doc/credit.php b/doc/credit.php index 2eda2df7ce..dfe54362a7 100644 --- a/doc/credit.php +++ b/doc/credit.php @@ -71,6 +71,7 @@ the following function is used to update the recent average credit of the host, user and team:
",htmlspecialchars(" + void update_average( double work_start_time, // when new work was started // (or zero if no new work) @@ -82,6 +83,24 @@ void update_average( double now = dtime(); if (avg_time) { + // If an average R already exists, imagine that the new work was done + // entirely between avg_time and now. + // That gives a rate R'. + // Replace R with a weighted average of R and R', + // weighted so that we get the right half-life if R' == 0. + // + // But this blows up if avg_time == now; you get 0*(1/0) + // So consider the limit as diff->0, + // using the first-order Taylor expansion of + // exp(x)=1+x+O(x^2). + // So to the lowest order in diff: + // weight = 1 - diff ln(2) / half_life + // so one has + // avg += (1-weight)*(work/diff_days) + // avg += [diff*ln(2)/half_life] * (work*SECONDS_PER_DAY/diff) + // notice that diff cancels out, leaving + // avg += [ln(2)/half_life] * work*SECONDS_PER_DAY + double diff, diff_days, weight; diff = now - avg_time; @@ -93,18 +112,18 @@ void update_average( avg *= weight; if ((1.0-weight) > 1.e-6) { - avg += (1-weight)*(work/diff_days); - } - else { + avg += (1-weight)*(work/diff_days); + } else { avg += M_LN2*work*SECONDS_PER_DAY/half_life; - } + } } else if (work) { + // If first time, average is just work/duration + // double dd = (now - work_start_time)/SECONDS_PER_DAY; avg = work/dd; } avg_time = now; } - "),"diff --git a/html/user/account_finish_action.php b/html/user/account_finish_action.php index 0e09032789..558755715b 100644 --- a/html/user/account_finish_action.php +++ b/html/user/account_finish_action.php @@ -30,7 +30,7 @@ if (!is_valid_country($country)) { show_error( "bad country"); } -$postal_code = strip_tags(process_user_text(post_str("postal_code"))); +$postal_code = strip_tags(process_user_text(post_str("postal_code", true))); $query = "update user set name='$name', country='$country', postal_code='$postal_code' where authenticator='$auth'"; $retval = mysql_query($query); diff --git a/lib/util.C b/lib/util.C index b740210498..58684c8c85 100755 --- a/lib/util.C +++ b/lib/util.C @@ -792,18 +792,6 @@ int boinc_calling_thread_cpu_time(double &cpu_t) { // NOTE: if you change this, also change update_average in // html/inc/credit.inc // - -// David, the quick fix I have done is minimalist. Consider the limit -// as diff->0, using the first-order Taylor expansion of -// exp(x)=1+x+O(x^2). -// So to the lowest order in diff: -// weight = 1 - diff ln(2) / half_life -// so one has -// avg += (1-weight)*(work/diff_days) -// avg += [diff*ln(2)/half_life] * (work*SECONDS_PER_DAY/diff) -// notice that diff cancels out, leaving -// avg += [ln(2)/half_life] * work*SECONDS_PER_DAY - void update_average( double work_start_time, // when new work was started // (or zero if no new work) @@ -815,6 +803,24 @@ void update_average( double now = dtime(); if (avg_time) { + // If an average R already exists, imagine that the new work was done + // entirely between avg_time and now. + // That gives a rate R'. + // Replace R with a weighted average of R and R', + // weighted so that we get the right half-life if R' == 0. + // + // But this blows up if avg_time == now; you get 0*(1/0) + // So consider the limit as diff->0, + // using the first-order Taylor expansion of + // exp(x)=1+x+O(x^2). + // So to the lowest order in diff: + // weight = 1 - diff ln(2) / half_life + // so one has + // avg += (1-weight)*(work/diff_days) + // avg += [diff*ln(2)/half_life] * (work*SECONDS_PER_DAY/diff) + // notice that diff cancels out, leaving + // avg += [ln(2)/half_life] * work*SECONDS_PER_DAY + double diff, diff_days, weight; diff = now - avg_time; @@ -826,12 +832,13 @@ void update_average( avg *= weight; if ((1.0-weight) > 1.e-6) { - avg += (1-weight)*(work/diff_days); - } - else { + avg += (1-weight)*(work/diff_days); + } else { avg += M_LN2*work*SECONDS_PER_DAY/half_life; - } + } } else if (work) { + // If first time, average is just work/duration + // double dd = (now - work_start_time)/SECONDS_PER_DAY; avg = work/dd; }