From 71b7e9b643930aa2504b1e38a131dd6def208a85 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Mon, 15 Aug 2022 10:08:50 -0400 Subject: [PATCH] Support comma-separated multi-location hints. --- src/allmydata/protocol_switch.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/allmydata/protocol_switch.py b/src/allmydata/protocol_switch.py index 158df32b5..89570436c 100644 --- a/src/allmydata/protocol_switch.py +++ b/src/allmydata/protocol_switch.py @@ -14,6 +14,8 @@ the configuration process. from __future__ import annotations +from itertools import chain + from twisted.internet.protocol import Protocol from twisted.internet.interfaces import IDelayedCall from twisted.internet.ssl import CertificateOptions @@ -94,7 +96,11 @@ class _FoolscapOrHttps(Protocol, metaclass=_PretendToBeNegotiation): ) storage_nurls = set() - for location_hint in cls.tub.locationHints: + # Individual hints can be in the form + # "tcp:host:port,tcp:host:port,tcp:host:port". + for location_hint in chain.from_iterable( + hints.split(",") for hints in cls.tub.locationHints + ): if location_hint.startswith("tcp:"): _, hostname, port = location_hint.split(":") port = int(port)