mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-26 05:27:38 +00:00
don't over-encode the nodeid many times with ascii-encoding
This commit is contained in:
parent
6683456eaa
commit
42f8e57416
src/allmydata
@ -1,6 +1,6 @@
|
||||
from base64 import b32encode
|
||||
|
||||
import os.path, re
|
||||
from base64 import b32decode, b32encode
|
||||
|
||||
import twisted
|
||||
from twisted.python import log
|
||||
@ -36,13 +36,11 @@ class Node(service.MultiService):
|
||||
self.tub = Tub(certFile=certfile)
|
||||
self.tub.setOption("logLocalFailures", True)
|
||||
self.tub.setOption("logRemoteFailures", True)
|
||||
# I think self.nodeid is kind of whacked. Shouldn't it equal the
|
||||
# fingerprint portion of our furl?
|
||||
self.nodeid = b32encode(self.tub.tubID).lower()
|
||||
self.nodeid = b32decode(self.tub.tubID.upper()) # binary format
|
||||
f = open(os.path.join(self.basedir, self.NODEIDFILE), "w")
|
||||
f.write(b32encode(self.nodeid).lower() + "\n")
|
||||
f.close()
|
||||
self.short_nodeid = self.tub.tubID[:4] # ready for printing
|
||||
self.short_nodeid = b32encode(self.nodeid).lower()[:8] # ready for printing
|
||||
assert self.PORTNUMFILE, "Your node.Node subclass must provide PORTNUMFILE"
|
||||
self._portnumfile = os.path.join(self.basedir, self.PORTNUMFILE)
|
||||
try:
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
from base64 import b32decode, b32encode
|
||||
import os
|
||||
from cStringIO import StringIO
|
||||
from twisted.trial import unittest
|
||||
@ -496,7 +497,7 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase):
|
||||
"I didn't see the right 'connected peers' message "
|
||||
"in: %s" % page
|
||||
)
|
||||
expected = "My nodeid: <span>%s</span>" % idlib.b2a(self.clients[0].nodeid)
|
||||
expected = "My nodeid: <span>%s</span>" % (b32encode(self.clients[0].nodeid).lower(),)
|
||||
self.failUnless(expected in page,
|
||||
"I didn't see the right 'My nodeid' message "
|
||||
"in: %s" % page)
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
from base64 import b32decode, b32encode
|
||||
import os.path
|
||||
from twisted.application import service, strports
|
||||
from twisted.web import static, resource, server, html, http
|
||||
@ -985,7 +986,7 @@ class Root(rend.Page):
|
||||
(v['allmydata'], v['zfec'], v['foolscap'], v['twisted'])
|
||||
|
||||
def data_my_nodeid(self, ctx, data):
|
||||
return idlib.b2a(IClient(ctx).nodeid)
|
||||
return b32encode(IClient(ctx).nodeid).lower()
|
||||
def data_introducer_furl(self, ctx, data):
|
||||
return IClient(ctx).introducer_furl
|
||||
def data_connected_to_introducer(self, ctx, data):
|
||||
@ -1005,7 +1006,7 @@ class Root(rend.Page):
|
||||
d = []
|
||||
client = IClient(ctx)
|
||||
for nodeid in sorted(client.get_all_peerids()):
|
||||
row = (idlib.b2a(nodeid),)
|
||||
row = (b32encode(nodeid).lower(),)
|
||||
d.append(row)
|
||||
return d
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user