[Pkg-mozext-commits] [perspectives-extension] 02/03: Perspectives - Move quorum calculation to its own function
David Prévot
taffit at alioth.debian.org
Mon Sep 30 02:15:03 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch patch-queue/wheezy
in repository perspectives-extension.
commit 262826190a276341cf2140d87ec07a86b2dab352
Author: Dave Schaefer <dave.schaefer at gmail.com>
Date: Sat Jul 21 13:04:45 2012 -0700
Perspectives - Move quorum calculation to its own function
This is in anticipation of writing code that will also call the function.
Let's separate some functionality to make things more object-oriented
and easier to use.
Origin: upstream, https://github.com/danwent/Perspectives/commit/fe6551ee7d26829bf69d00f49579fc1be48f42a8
---
plugin/chrome/content/notaries.js | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/plugin/chrome/content/notaries.js b/plugin/chrome/content/notaries.js
index 2bdecb6..cb12d61 100644
--- a/plugin/chrome/content/notaries.js
+++ b/plugin/chrome/content/notaries.js
@@ -391,6 +391,14 @@ var Perspectives = {
}
},
+ // return the quorum as an integer
+ // e.g. useful for comparing against the number of results
+ getQuorumAsInt: function() {
+ var q_thresh = Perspectives.root_prefs.
+ getIntPref("perspectives.quorum_thresh") / 100;
+ return Math.round(this.all_notaries.length * q_thresh);
+ },
+
notaryQueriesComplete: function(ti) {
try {
if(Perspectives.strbundle == null) {
@@ -404,9 +412,7 @@ var Perspectives = {
var test_key = ti.cert.md5Fingerprint.toLowerCase();
// 2 days (FIXME: make this a pref)
var max_stale_sec = 2 * 24 * 3600;
- var q_thresh = Perspectives.root_prefs.
- getIntPref("perspectives.quorum_thresh") / 100;
- var q_required = Math.round(this.all_notaries.length * q_thresh);
+ var q_required = Perspectives.getQuorumAsInt();
var unixtime = Pers_util.get_unix_time();
var quorum_duration = Pers_client_policy.get_quorum_duration(test_key,
server_result_list, q_required, max_stale_sec,unixtime);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/perspectives-extension.git
More information about the Pkg-mozext-commits
mailing list