diff options
| author | Riccardo Spagni <ric@spagni.net> | 2017-11-25 19:48:33 +0200 |
|---|---|---|
| committer | Riccardo Spagni <ric@spagni.net> | 2017-11-25 19:48:33 +0200 |
| commit | ed2fc4a1ffaf2af5d96545332db367e7033e8c1a (patch) | |
| tree | 2d86cb3921ac2b15dc239b9a7c66e4c7d88ce20e /src/cryptonote_core/cryptonote_core.cpp | |
| parent | 7ae7e5ef933f8f807867f5038344a87b49158003 (diff) | |
| parent | 43f27c7d43ee5cae601e1fb0181cba2ccfd7baa6 (diff) | |
| download | monzero-core-ed2fc4a1ffaf2af5d96545332db367e7033e8c1a.tar.gz monzero-core-ed2fc4a1ffaf2af5d96545332db367e7033e8c1a.tar.xz monzero-core-ed2fc4a1ffaf2af5d96545332db367e7033e8c1a.zip | |
Merge pull request #2794
43f27c7d core: warn when free disk space is low (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core/cryptonote_core.cpp')
| -rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index acc76a8d6..5c181208f 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1336,6 +1336,7 @@ namespace cryptonote m_fork_moaner.do_call(boost::bind(&core::check_fork_time, this)); m_txpool_auto_relayer.do_call(boost::bind(&core::relay_txpool_transactions, this)); m_check_updates_interval.do_call(boost::bind(&core::check_updates, this)); + m_check_disk_space_interval.do_call(boost::bind(&core::check_disk_space, this)); m_miner.on_idle(); m_mempool.on_idle(); return true; @@ -1467,6 +1468,17 @@ namespace cryptonote return true; } //----------------------------------------------------------------------------------------------- + bool core::check_disk_space() + { + uint64_t free_space = get_free_space(); + if (free_space < 1ull * 1024 * 1024 * 1024) // 1 GB + { + const el::Level level = el::Level::Warning; + MCLOG_RED(level, "global", "Free space is below 1 GB on " << m_config_folder); + } + return true; + } + //----------------------------------------------------------------------------------------------- void core::set_target_blockchain_height(uint64_t target_blockchain_height) { m_target_blockchain_height = target_blockchain_height; @@ -1482,6 +1494,13 @@ namespace cryptonote return get_blockchain_storage().prevalidate_block_hashes(height, hashes); } //----------------------------------------------------------------------------------------------- + uint64_t core::get_free_space() const + { + boost::filesystem::path path(m_config_folder); + boost::filesystem::space_info si = boost::filesystem::space(path); + return si.available; + } + //----------------------------------------------------------------------------------------------- std::time_t core::get_start_time() const { return start_time; |
