mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-18 23:38:18 +00:00
post-rebase fixup: _client_factory and docs
This commit is contained in:
@ -201,23 +201,26 @@ def create_client(basedir=u".", _client_factory=None):
|
|||||||
node.create_node_dir(basedir, CLIENT_README)
|
node.create_node_dir(basedir, CLIENT_README)
|
||||||
config = read_config(basedir, u"client.port")
|
config = read_config(basedir, u"client.port")
|
||||||
|
|
||||||
if _client_factory is None:
|
|
||||||
_client_factory = _Client
|
|
||||||
|
|
||||||
# read config file and create instance
|
# read config file and create instance
|
||||||
config = read_config(basedir, u"client.port")
|
config = read_config(basedir, u"client.port")
|
||||||
return create_client_from_config(config) # async
|
return create_client_from_config(config, _client_factory=_client_factory) # async
|
||||||
|
|
||||||
|
|
||||||
# this method is async
|
# this method is async
|
||||||
# @defer.inlineCallbacks
|
# @defer.inlineCallbacks
|
||||||
def create_client_from_config(config):
|
def create_client_from_config(config, _client_factory=None):
|
||||||
"""
|
"""
|
||||||
Create a new _Client instance given a _Config instance (basedir
|
Creates a new client instance (a subclass of Node). Most code
|
||||||
must already exist and be writable).
|
should probably use `create_client` instead.
|
||||||
|
|
||||||
Most code should probably use `create_client` instead.
|
:param config: configuration instance (from read_config()) which
|
||||||
|
encapsulates everything in the "node directory".
|
||||||
|
|
||||||
|
:param _client_factory: for testing; the class to instantiate
|
||||||
"""
|
"""
|
||||||
|
if _client_factory is None:
|
||||||
|
_client_factory = _Client
|
||||||
|
|
||||||
i2p_provider = create_i2p_provider(reactor, config)
|
i2p_provider = create_i2p_provider(reactor, config)
|
||||||
tor_provider = create_tor_provider(reactor, config)
|
tor_provider = create_tor_provider(reactor, config)
|
||||||
handlers = node.create_connection_handlers(reactor, config, i2p_provider, tor_provider)
|
handlers = node.create_connection_handlers(reactor, config, i2p_provider, tor_provider)
|
||||||
@ -236,7 +239,7 @@ def create_client_from_config(config):
|
|||||||
tub_options, introducer_clients
|
tub_options, introducer_clients
|
||||||
)
|
)
|
||||||
|
|
||||||
client = _Client(
|
client = _client_factory(
|
||||||
config,
|
config,
|
||||||
main_tub,
|
main_tub,
|
||||||
control_tub,
|
control_tub,
|
||||||
|
Reference in New Issue
Block a user