automatically try to detect if the server supports the multi-cluster call (hack hack hack)
authorDan Mills <thunder@mozilla.com>
Tue, 10 Feb 2009 15:56:37 -0800
changeset 45235 eeb85b7edcab0dfbc5325a3f1403fed24ee7d871
parent 45234 8b2a8d5d37cbb3957485878cfff591e14682e029
child 45236 99bd435ddffc1f8d224034bec5fbc11e794cebb1
push idunknown
push userunknown
push dateunknown
automatically try to detect if the server supports the multi-cluster call (hack hack hack)
services/sync/modules/service.js
services/sync/services-sync.js
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -426,31 +426,32 @@ WeaveSvc.prototype = {
   },
 
   // These are global (for all engines)
 
   // gets cluster from central LDAP server and sets this.clusterURL
   findCluster: function WeaveSvc_findCluster(onComplete, username) {
     let fn = function WeaveSvc__findCluster() {
       let self = yield;
-      if (Svc.Prefs.get("independentNode")) {
-	this._log.debug("Using serverURL as data cluster (multi-cluster support disabled)");
-	this.clusterURL = Svc.Prefs.get("serverURL");
-	self.done(true);
-	return;
-      }
+      let ret = false;
+
       this._log.debug("Finding cluster for user " + username);
       let res = new Resource(this.baseURL + "api/register/chknode/" + username);
       yield res.get(self.cb);
-      if (res.lastChannel.responseStatus != 200) {
-	self.done(false);
-	return;
+
+      if (res.lastChannel.responseStatus == 404) {
+        this._log.debug("Using serverURL as data cluster (multi-cluster support disabled)");
+        this.clusterURL = Svc.Prefs.get("serverURL");
+        ret = true;
+
+      } else if (res.lastChannel.responseStatus == 200) {
+        this.clusterURL = 'https://' + res.data + '/';
+        ret = true;
       }
-      this.clusterURL = 'https://' + res.data + '/';
-      self.done(true);
+      self.done(ret);
     };
     fn.async(this, onComplete);
   },
 
   verifyLogin: function WeaveSvc_verifyLogin(onComplete, username, password, isLogin) {
     let user = username, pass = password;
 
     let fn = function WeaveSvc__verifyLogin() {
--- a/services/sync/services-sync.js
+++ b/services/sync/services-sync.js
@@ -1,10 +1,9 @@
 pref("extensions.weave.serverURL", "https://services.mozilla.com/");
-pref("extensions.weave.independentNode", false);
 
 pref("extensions.weave.encryption", "aes-256-cbc");
 
 pref("extensions.weave.lastversion", "firstrun");
 pref("extensions.weave.lastsync", "0");
 
 pref("extensions.weave.ui.syncnow", true);
 pref("extensions.weave.ui.sharebookmarks", false);