mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-21 12:05:03 +00:00
Pass in a pool instead of pool options.
This commit is contained in:
parent
d96a22e48b
commit
e989677319
@ -311,21 +311,18 @@ class StorageClient(object):
|
||||
|
||||
@classmethod
|
||||
def from_nurl(
|
||||
cls, nurl: DecodedURL, reactor, persistent=True, retryAutomatically=True
|
||||
cls, nurl: DecodedURL, reactor, pool: Optional[HTTPConnectionPool] = None
|
||||
) -> StorageClient:
|
||||
"""
|
||||
Create a ``StorageClient`` for the given NURL.
|
||||
|
||||
``persistent`` and ``retryAutomatically`` arguments are passed to the
|
||||
new HTTPConnectionPool.
|
||||
"""
|
||||
assert nurl.fragment == "v=1"
|
||||
assert nurl.scheme == "pb"
|
||||
swissnum = nurl.path[0].encode("ascii")
|
||||
certificate_hash = nurl.user.encode("ascii")
|
||||
pool = HTTPConnectionPool(reactor, persistent=persistent)
|
||||
pool.retryAutomatically = retryAutomatically
|
||||
pool.maxPersistentPerHost = 20
|
||||
if pool is None:
|
||||
pool = HTTPConnectionPool(reactor)
|
||||
pool.maxPersistentPerHost = 20
|
||||
|
||||
if cls.TEST_MODE_REGISTER_HTTP_POOL is not None:
|
||||
cls.TEST_MODE_REGISTER_HTTP_POOL(pool)
|
||||
|
@ -43,6 +43,7 @@ from configparser import NoSectionError
|
||||
|
||||
import attr
|
||||
from hyperlink import DecodedURL
|
||||
from twisted.web.client import HTTPConnectionPool
|
||||
from zope.interface import (
|
||||
Attribute,
|
||||
Interface,
|
||||
@ -1205,10 +1206,10 @@ class HTTPNativeStorageServer(service.MultiService):
|
||||
def request(reactor, nurl: DecodedURL):
|
||||
# Since we're just using this one off to check if the NURL
|
||||
# works, no need for persistent pool or other fanciness.
|
||||
pool = HTTPConnectionPool(reactor, persistent=False)
|
||||
pool.retryAutomatically = False
|
||||
return StorageClientGeneral(
|
||||
StorageClient.from_nurl(
|
||||
nurl, reactor, persistent=False, retryAutomatically=False
|
||||
)
|
||||
StorageClient.from_nurl(nurl, reactor, pool)
|
||||
).get_version()
|
||||
|
||||
# LoopingCall.stop() doesn't cancel Deferreds, unfortunately:
|
||||
|
Loading…
Reference in New Issue
Block a user