mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 21:43:09 +00:00
confwiz: set a convergence domain based on root_dir upon config
when the confwiz configures a node (i.e. typically once on mac, once per install on windows) in addition to writing the root_dir.cap retrieved from the native_client backend into a config file, it additionally writes a hash thereof into the 'convergence' config file. this causes uploads from this node to use a consistent 'convergence' hashing value matching any other nodes with the same configured root_dir, i.e. for the most part other systems installed and configured on the same account.
This commit is contained in:
parent
d25d3065d1
commit
7f14b93341
@ -7,6 +7,8 @@ WELCOME_PAGE = 'welcome_install'
|
||||
TAHOESVC_NAME = 'Tahoe'
|
||||
WINFUSESVC_NAME = 'Allmydata SMB'
|
||||
|
||||
CONVERGENCE_DOMAIN_TAG = "allmydata_root_cap_to_convergence_domain_tag_v1"
|
||||
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
@ -19,6 +21,7 @@ import webbrowser
|
||||
import wx
|
||||
|
||||
from allmydata.util.assertutil import precondition
|
||||
from allmydata.util import hashutil, base32
|
||||
from allmydata import uri
|
||||
import allmydata
|
||||
|
||||
@ -113,6 +116,11 @@ def write_config_file(filename, contents):
|
||||
iff.write(contents)
|
||||
iff.close()
|
||||
|
||||
def write_root_cap(root_cap):
|
||||
write_config_file('private/root_dir.cap', root_cap+'\n')
|
||||
convergence = base32.b2a(hashutil.tagged_hash(CONVERGENCE_DOMAIN_TAG, root_cap))
|
||||
write_config_file('private/convergence', convergence+'\n')
|
||||
|
||||
def get_nodeid():
|
||||
CERTFILE = "node.pem"
|
||||
certfile = os.path.join(get_basedir(), "private", CERTFILE)
|
||||
@ -350,7 +358,7 @@ class LoginPanel(wx.Panel):
|
||||
|
||||
try:
|
||||
root_cap = get_root_cap(backend, user, passwd)
|
||||
write_config_file('private/root_dir.cap', root_cap+'\n')
|
||||
write_root_cap(root_cap)
|
||||
except AuthError:
|
||||
self.warning_label.SetLabel('Your email and/or password is incorrect')
|
||||
self.user_field.SetFocus()
|
||||
@ -474,7 +482,7 @@ class RegisterPanel(wx.Panel):
|
||||
try:
|
||||
#print 'calling get_root_cap (ae)', time.asctime()
|
||||
root_cap = get_root_cap(backend, user, passwd)
|
||||
write_config_file('private/root_dir.cap', root_cap+'\n')
|
||||
write_root_cap(root_cap)
|
||||
except AuthError:
|
||||
self.warning_label.SetLabel('That email address is already registered')
|
||||
self.user_field.SetFocus()
|
||||
@ -488,7 +496,7 @@ class RegisterPanel(wx.Panel):
|
||||
elif result_code == 'ok':
|
||||
#print 'calling get_root_cap (ok)', time.asctime()
|
||||
root_cap = get_root_cap(backend, user, passwd)
|
||||
write_config_file('private/root_dir.cap', root_cap+'\n')
|
||||
write_root_cap(root_cap)
|
||||
else:
|
||||
self.warning_label.SetLabel('an unexpected error occurred ("%s")' % (result_code,))
|
||||
self.user_field.SetFocus()
|
||||
|
Loading…
Reference in New Issue
Block a user