aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/command_line.cpp63
-rw-r--r--src/common/command_line.h15
-rw-r--r--src/common/int-util.h4
-rw-r--r--src/common/password.cpp11
-rw-r--r--src/common/password.h2
-rw-r--r--src/common/threadpool.cpp4
-rw-r--r--src/common/updates.cpp2
-rw-r--r--src/common/util.cpp2
8 files changed, 11 insertions, 92 deletions
diff --git a/src/common/command_line.cpp b/src/common/command_line.cpp
index d4a28fc85..4b9ca9559 100644
--- a/src/common/command_line.cpp
+++ b/src/common/command_line.cpp
@@ -36,10 +36,6 @@
#include "cryptonote_config.h"
#include "string_tools.h"
-#ifdef HAVE_READLINE
- #include "readline_buffer.h"
-#endif
-
namespace command_line
{
namespace
@@ -50,20 +46,6 @@ namespace command_line
}
}
- std::string input_line(const std::string& prompt)
- {
-#ifdef HAVE_READLINE
- rdln::suspend_readline pause_readline;
-#endif
- std::cout << prompt;
-
- std::string buf;
- std::getline(std::cin, buf);
-
- return epee::string_tools::trim(buf);
-
- }
-
bool is_yes(const std::string& str)
{
if (str == "y" || str == "Y")
@@ -94,49 +76,4 @@ namespace command_line
const arg_descriptor<bool> arg_help = {"help", "Produce help message"};
const arg_descriptor<bool> arg_version = {"version", "Output version information"};
- const arg_descriptor<std::string> arg_data_dir = {"data-dir", "Specify data directory"};
- const arg_descriptor<std::string> arg_testnet_data_dir = {"testnet-data-dir", "Specify testnet data directory"};
- const arg_descriptor<bool> arg_test_drop_download = {"test-drop-download", "For net tests: in download, discard ALL blocks instead checking/saving them (very fast)"};
- const arg_descriptor<uint64_t> arg_test_drop_download_height = {"test-drop-download-height", "Like test-drop-download but disards only after around certain height", 0};
- const arg_descriptor<int> arg_test_dbg_lock_sleep = {"test-dbg-lock-sleep", "Sleep time in ms, defaults to 0 (off), used to debug before/after locking mutex. Values 100 to 1000 are good for tests."};
- const arg_descriptor<bool, false> arg_testnet_on = {
- "testnet"
- , "Run on testnet. The wallet must be launched with --testnet flag."
- , false
- };
- const arg_descriptor<bool> arg_dns_checkpoints = {
- "enforce-dns-checkpointing"
- , "checkpoints from DNS server will be enforced"
- , false
- };
- const command_line::arg_descriptor<uint64_t> arg_fast_block_sync = {
- "fast-block-sync"
- , "Sync up most of the way by using embedded, known block hashes."
- , 1
- };
- const command_line::arg_descriptor<uint64_t> arg_prep_blocks_threads = {
- "prep-blocks-threads"
- , "Max number of threads to use when preparing block hashes in groups."
- , 4
- };
- const command_line::arg_descriptor<uint64_t> arg_show_time_stats = {
- "show-time-stats"
- , "Show time-stats when processing blocks/txs and disk synchronization."
- , 0
- };
- const command_line::arg_descriptor<size_t> arg_block_sync_size = {
- "block-sync-size"
- , "How many blocks to sync at once during chain synchronization (0 = adaptive)."
- , 0
- };
- const command_line::arg_descriptor<std::string> arg_check_updates = {
- "check-updates"
- , "Check for new versions of monero: [disabled|notify|download|update]"
- , "notify"
- };
- const arg_descriptor<bool> arg_fluffy_blocks = {
- "fluffy-blocks"
- , "Relay blocks as fluffy blocks where possible (automatic on testnet)"
- , false
- };
}
diff --git a/src/common/command_line.h b/src/common/command_line.h
index bfc8b19c6..c2bac9cc8 100644
--- a/src/common/command_line.h
+++ b/src/common/command_line.h
@@ -41,8 +41,6 @@
namespace command_line
{
- std::string input_line(const std::string& prompt);
-
//! \return True if `str` is `is_iequal("y" || "yes" || `tr("yes"))`.
bool is_yes(const std::string& str);
//! \return True if `str` is `is_iequal("n" || "no" || `tr("no"))`.
@@ -213,17 +211,4 @@ namespace command_line
extern const arg_descriptor<bool> arg_help;
extern const arg_descriptor<bool> arg_version;
- extern const arg_descriptor<std::string> arg_data_dir;
- extern const arg_descriptor<std::string> arg_testnet_data_dir;
- extern const arg_descriptor<bool> arg_test_drop_download;
- extern const arg_descriptor<uint64_t> arg_test_drop_download_height;
- extern const arg_descriptor<int> arg_test_dbg_lock_sleep;
- extern const arg_descriptor<bool, false> arg_testnet_on;
- extern const arg_descriptor<bool> arg_dns_checkpoints;
- extern const arg_descriptor<uint64_t> arg_fast_block_sync;
- extern const arg_descriptor<uint64_t> arg_prep_blocks_threads;
- extern const arg_descriptor<uint64_t> arg_show_time_stats;
- extern const arg_descriptor<size_t> arg_block_sync_size;
- extern const arg_descriptor<std::string> arg_check_updates;
- extern const arg_descriptor<bool> arg_fluffy_blocks;
}
diff --git a/src/common/int-util.h b/src/common/int-util.h
index 34288805a..7cec571ad 100644
--- a/src/common/int-util.h
+++ b/src/common/int-util.h
@@ -40,6 +40,10 @@
#include <byteswap.h>
#endif
+#if defined(__sun) && defined(__SVR4)
+#include <endian.h>
+#endif
+
#if defined(_MSC_VER)
#include <stdlib.h>
diff --git a/src/common/password.cpp b/src/common/password.cpp
index 5c04023f4..5d56464a5 100644
--- a/src/common/password.cpp
+++ b/src/common/password.cpp
@@ -88,13 +88,11 @@ namespace
{
pass.back() = '\0';
pass.resize(pass.size() - 1);
- std::cout << "\b \b";
}
}
else
{
pass.push_back(ch);
- std::cout << '*';
}
}
@@ -150,13 +148,11 @@ namespace
{
aPass.back() = '\0';
aPass.resize(aPass.size() - 1);
- std::cout << "\b \b";
}
}
else
{
aPass.push_back(ch);
- std::cout << '*';
}
}
@@ -242,9 +238,6 @@ namespace tools
boost::optional<password_container> password_container::prompt(const bool verify, const char *message)
{
-#ifdef HAVE_READLINE
- rdln::suspend_readline pause_readline;
-#endif
password_container pass1{};
password_container pass2{};
if (is_cin_tty() ? read_from_tty(verify, message, pass1.m_password, pass2.m_password) : read_from_file(pass1.m_password))
@@ -253,7 +246,7 @@ namespace tools
return boost::none;
}
- boost::optional<login> login::parse(std::string&& userpass, bool verify, const char* message)
+ boost::optional<login> login::parse(std::string&& userpass, bool verify, const std::function<boost::optional<password_container>(bool)> &prompt)
{
login out{};
password_container wipe{std::move(userpass)};
@@ -261,7 +254,7 @@ namespace tools
const auto loc = wipe.password().find(':');
if (loc == std::string::npos)
{
- auto result = tools::password_container::prompt(verify, message);
+ auto result = prompt(verify);
if (!result)
return boost::none;
diff --git a/src/common/password.h b/src/common/password.h
index 12f715df4..ba1c30a28 100644
--- a/src/common/password.h
+++ b/src/common/password.h
@@ -82,7 +82,7 @@ namespace tools
\return The username and password, or boost::none if
`password_container::prompt` fails.
*/
- static boost::optional<login> parse(std::string&& userpass, bool verify, const char* message = "Password");
+ static boost::optional<login> parse(std::string&& userpass, bool verify, const std::function<boost::optional<password_container>(bool)> &prompt);
login(const login&) = delete;
login(login&&) = default;
diff --git a/src/common/threadpool.cpp b/src/common/threadpool.cpp
index 41d0c25e0..20c5765b0 100644
--- a/src/common/threadpool.cpp
+++ b/src/common/threadpool.cpp
@@ -39,7 +39,7 @@ namespace tools
threadpool::threadpool() : running(true), active(0) {
boost::thread::attributes attrs;
attrs.set_stack_size(THREAD_STACK_SIZE);
- max = tools::get_max_concurrency() * 2;
+ max = tools::get_max_concurrency();
size_t i = max;
while(i--) {
threads.push_back(boost::thread(attrs, boost::bind(&threadpool::run, this)));
@@ -74,7 +74,7 @@ void threadpool::submit(waiter *obj, std::function<void()> f) {
}
int threadpool::get_max_concurrency() {
- return max / 2;
+ return max;
}
void threadpool::waiter::wait() {
diff --git a/src/common/updates.cpp b/src/common/updates.cpp
index 8a057b1cf..141330c2c 100644
--- a/src/common/updates.cpp
+++ b/src/common/updates.cpp
@@ -100,7 +100,7 @@ namespace tools
{
const char *base = user ? "https://downloads.getmonero.org/" : "http://updates.getmonero.org/";
#ifdef _WIN32
- static const char extension[] = ".zip";
+ static const char *extension = strncmp(buildtag.c_str(), "install-", 8) ? ".zip" : ".exe";
#else
static const char extension[] = ".tar.bz2";
#endif
diff --git a/src/common/util.cpp b/src/common/util.cpp
index 1e180d325..a13ac6e50 100644
--- a/src/common/util.cpp
+++ b/src/common/util.cpp
@@ -405,7 +405,7 @@ namespace tools
#else
std::string get_nix_version_display_string()
{
- utsname un;
+ struct utsname un;
if(uname(&un) < 0)
return std::string("*nix: failed to get os version");