From fb0b5b2e5ba49ed0799e9efed0978be3cf981273 Mon Sep 17 00:00:00 2001 From: arkpar Date: Tue, 16 Feb 2016 00:22:44 +0100 Subject: [PATCH 1/2] Raise fd limit in linux --- util/fdlimit/src/raise_fd_limit.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/util/fdlimit/src/raise_fd_limit.rs b/util/fdlimit/src/raise_fd_limit.rs index f57ac2785..92127da35 100644 --- a/util/fdlimit/src/raise_fd_limit.rs +++ b/util/fdlimit/src/raise_fd_limit.rs @@ -57,5 +57,28 @@ pub unsafe fn raise_fd_limit() { } } -#[cfg(not(any(target_os = "macos", target_os = "ios")))] +#[cfg(any(target_os = "linux"))] +#[allow(non_camel_case_types)] +pub unsafe fn raise_fd_limit() { + use libc; + use std::io; + + // Fetch the current resource limits + let mut rlim = libc::rlimit{rlim_cur: 0, rlim_max: 0}; + if libc::getrlimit(libc::RLIMIT_NOFILE, &mut rlim) != 0 { + let err = io::Error::last_os_error(); + panic!("raise_fd_limit: error calling getrlimit: {}", err); + } + + // Set soft limit to hard imit + rlim.rlim_cur = rlim.rlim_max; + + // Set our newly-increased resource limit + if libc::setrlimit(libc::RLIMIT_NOFILE, &rlim) != 0 { + let err = io::Error::last_os_error(); + panic!("raise_fd_limit: error calling setrlimit: {}", err); + } +} + +#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "linux")))] pub unsafe fn raise_fd_limit() {} From dbf3691c22870e7079d5976c19658c70232ad363 Mon Sep 17 00:00:00 2001 From: arkpar Date: Tue, 16 Feb 2016 01:13:13 +0100 Subject: [PATCH 2/2] Return nothing on state requests instead of panicing --- ethcore/src/client.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ethcore/src/client.rs b/ethcore/src/client.rs index 09f7417e8..03c470bdb 100644 --- a/ethcore/src/client.rs +++ b/ethcore/src/client.rs @@ -419,11 +419,11 @@ impl BlockChainClient for Client { } fn state_data(&self, _hash: &H256) -> Option { - unimplemented!(); + None } fn block_receipts(&self, _hash: &H256) -> Option { - unimplemented!(); + None } fn import_block(&self, bytes: Bytes) -> ImportResult {