From e18dacd26b0397ef395fdb0809f68c1e87594bd1 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Mon, 8 Feb 2016 16:51:38 -0500 Subject: [PATCH] extend torrent webseed lifetime to an hour --- config.py | 1 + endpoints/verbs.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config.py b/config.py index d0766680e..46c295b8e 100644 --- a/config.py +++ b/config.py @@ -289,6 +289,7 @@ class DefaultConfig(object): BITTORRENT_PIECE_SIZE = 512 * 1024 BITTORRENT_ANNOUNCE_URL = 'https://localhost:6881/announce' BITTORRENT_FILENAME_PEPPER = '3ae93fef-c30a-427e-9ba0-eea0fd710419' + BITTORRENT_WEBSEED_LIFETIME = 3600 # "Secret" key for generating encrypted paging tokens. Only needed to be secret to # hide the ID range for production (in which this value is overridden). Should *not* diff --git a/endpoints/verbs.py b/endpoints/verbs.py index 17539daed..f9ab20985 100644 --- a/endpoints/verbs.py +++ b/endpoints/verbs.py @@ -137,7 +137,8 @@ def _torrent_for_storage(storage_ref, is_public): # Lookup the webseed path for the storage. path = model.storage.get_layer_path(storage_ref) - webseed = storage.get_direct_download_url(storage_ref.locations, path) + webseed = storage.get_direct_download_url(storage_ref.locations, path, + expires_in=app.config['BITTORRENT_WEBSEED_LIFETIME']) if webseed is None: # We cannot support webseeds for storages that cannot provide direct downloads. abort(make_response('Storage engine does not support seeding.', 501))