A lot closer to working end-to-end.

This commit is contained in:
Itamar Turner-Trauring 2022-08-11 16:24:33 -04:00
parent 9ad4e844e8
commit f671fb04a1
2 changed files with 11 additions and 4 deletions

View File

@ -825,9 +825,9 @@ class _Client(node.Node, pollmixin.PollMixin):
furl_file = self.config.get_private_path("storage.furl").encode(get_filesystem_encoding())
furl = self.tub.registerReference(FoolscapStorageServer(ss), furlFile=furl_file)
(_, _, swissnum) = furl.rpartition("/")
self.storage_nurls.update(
self.tub.negotiationClass.add_storage_server(ss, swissnum.encode("ascii"))
)
nurls = self.tub.negotiationClass.add_storage_server(ss, swissnum.encode("ascii"))
self.storage_nurls.update(nurls)
announcement["anonymous-storage-NURLs"] = [n.to_text() for n in nurls]
announcement["anonymous-storage-FURL"] = furl
enabled_storage_servers = self._enable_storage_servers(

View File

@ -39,6 +39,7 @@ from os import urandom
from configparser import NoSectionError
import attr
from hyperlink import DecodedURL
from zope.interface import (
Attribute,
Interface,
@ -264,6 +265,12 @@ class StorageFarmBroker(service.MultiService):
by the given announcement.
"""
assert isinstance(server_id, bytes)
# TODO use constant
if "anonymous-storage-NURLs" in server["ann"]:
print("HTTTTTTTPPPPPPPPPPPPPPPPPPPP")
s = HTTPNativeStorageServer(server_id, server["ann"])
s.on_status_changed(lambda _: self._got_connection())
return s
handler_overrides = server.get("connections", {})
s = NativeStorageServer(
server_id,
@ -950,7 +957,7 @@ class HTTPNativeStorageServer(service.MultiService):
self._nickname, self._permutation_seed, self._tubid, self._short_description, self._long_description = _parse_announcement(server_id, furl, announcement)
self._istorage_server = _HTTPStorageServer.from_http_client(
StorageClient.from_nurl(
announcement["anonymous-storage-NURLs"][0], reactor
DecodedURL.from_text(announcement["anonymous-storage-NURLs"][0]), reactor
)
)
self._connection_status = connection_status.ConnectionStatus.unstarted()