mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-13 13:53:07 +00:00
post-rebase fixup: _client_factory and docs
This commit is contained in:
parent
c7b47f44d2
commit
c84e50baf0
@ -201,23 +201,26 @@ def create_client(basedir=u".", _client_factory=None):
|
||||
node.create_node_dir(basedir, CLIENT_README)
|
||||
config = read_config(basedir, u"client.port")
|
||||
|
||||
if _client_factory is None:
|
||||
_client_factory = _Client
|
||||
|
||||
# read config file and create instance
|
||||
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
|
||||
# @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
|
||||
must already exist and be writable).
|
||||
Creates a new client instance (a subclass of Node). Most code
|
||||
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)
|
||||
tor_provider = create_tor_provider(reactor, config)
|
||||
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
|
||||
)
|
||||
|
||||
client = _Client(
|
||||
client = _client_factory(
|
||||
config,
|
||||
main_tub,
|
||||
control_tub,
|
||||
|
Loading…
x
Reference in New Issue
Block a user