Pass I2P keyfile to foolscap

If no session management is performed, txi2p starts a process-wide session the
first time a connection (client or server) is opened; all subsequent connections
use that session and its configuration properties.

This commit ensures that the same properties are passed to both client and
server endpoints, so that the correct I2P Destination is started regardless of
whether the first connection made by Tahoe-LAFS is for a client or server.

Closes #2858.
This commit is contained in:
str4d 2017-01-11 07:01:36 +13:00 committed by Brian Warner
parent 5e1d464a65
commit 998af5c26e

View File

@ -147,13 +147,14 @@ class Provider(service.MultiService):
sam_port = self._get_i2p_config("sam.port", None)
launch = self._get_i2p_config("launch", False, boolean=True)
configdir = self._get_i2p_config("i2p.configdir", None)
keyfile = self._get_i2p_config("dest.private_key_file", None)
if sam_port:
if launch:
raise ValueError("tahoe.cfg [i2p] must not set both "
"sam.port and launch")
ep = clientFromString(self._reactor, sam_port)
return self._i2p.sam_endpoint(ep)
return self._i2p.sam_endpoint(ep, keyfile=keyfile)
if launch:
executable = self._get_i2p_config("i2p.executable", None)
@ -162,7 +163,7 @@ class Provider(service.MultiService):
if configdir:
return self._i2p.local_i2p(configdir)
return self._i2p.default(self._reactor)
return self._i2p.default(self._reactor, keyfile=keyfile)
def check_dest_config(self):
if self._get_i2p_config("dest", False, boolean=True):