From e0b4506474f16c96c02a5943dd26c784a84ba6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= Date: Thu, 22 Feb 2018 10:22:25 +0000 Subject: [PATCH] Increase max download limit to 128MB (#7965) * fetch: increase max download limit to 64MB * parity: increase download size limit for updater service --- parity/run.rs | 6 +++++- util/fetch/src/client.rs | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/parity/run.rs b/parity/run.rs index 5dd0bf437..d8abf40c0 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -680,11 +680,15 @@ pub fn execute_impl(cmd: RunCmd, can_restart: bool, logger: Arc) let contract_client = Arc::new(::dapps::FullRegistrar::new(client.clone())); // the updater service + let mut updater_fetch = fetch.clone(); + // parity binaries should be smaller than 128MB + updater_fetch.set_limit(Some(128 * 1024 * 1024)); + let updater = Updater::new( Arc::downgrade(&(service.client() as Arc)), Arc::downgrade(&sync_provider), update_policy, - hash_fetch::Client::with_fetch(contract_client.clone(), fetch.clone(), event_loop.remote()) + hash_fetch::Client::with_fetch(contract_client.clone(), updater_fetch, event_loop.remote()) ); service.add_notify(updater.clone()); diff --git a/util/fetch/src/client.rs b/util/fetch/src/client.rs index b5aebfa01..bcd534cb3 100644 --- a/util/fetch/src/client.rs +++ b/util/fetch/src/client.rs @@ -127,6 +127,11 @@ impl Client { }) } + /// Sets a limit on the maximum download size. + pub fn set_limit(&mut self, limit: Option) { + self.limit = limit + } + fn client(&self) -> Result, Error> { { let (ref time, ref client) = *self.client.read(); @@ -150,8 +155,8 @@ impl Fetch for Client { type Result = CpuFuture; fn new() -> Result { - // Max 50MB will be downloaded. - Self::with_limit(Some(50*1024*1024)) + // Max 64MB will be downloaded. + Self::with_limit(Some(64 * 1024 * 1024)) } fn process(&self, f: F) -> BoxFuture where