Commit Graph

225 Commits

Author SHA1 Message Date
moneromooo-monero 8f96cfc20a
Remove typeid use in network_address
Since I had to add an ID to the derived classes anyway,
this can be used instead. This removes an apparently
pointless warning from CLANG too.
2017-06-28 09:11:24 +01:00
binaryFate a282c5756c Fix #2071: remove declaration of unused variable "it" in epee 2017-06-26 12:32:01 +02:00
Jethro Grassie be9d4f0411
Fix multiline wallet cli output with readline
monero-wallet-cli commands which have multine output sometimes causes
issues with the readline support. This patch fixes show_transfers,
payments and incoming_transfers.
2017-06-25 10:48:02 -04:00
Jethro Grassie fdccf7e6c3
Add readline improvements
Color prompt now working and no reprompting on exit command.
2017-06-24 07:34:56 -04:00
Riccardo Spagni 0c6ea4f8a6
Merge pull request #2111
8261ba69 readline_buffer: fix busy wait (moneromooo-monero)
2017-06-24 12:48:37 +02:00
Riccardo Spagni a0b494aa71
Merge pull request #2103
21b939e1 readline: fix invalid memory access (moneromooo-monero)
5f8f2905 readline_buffer: add a couple const (moneromooo-monero)
2017-06-24 12:48:13 +02:00
Riccardo Spagni f31b89012d
Merge pull request #2073
07c4276c Don't issue a new timedsync while one is already in progress (Howard Chu)
cf3a376c Don't timeout a slow operation that's making progress (Howard Chu)
340830de Fix PR#2039 (Howard Chu)
2017-06-24 12:41:09 +02:00
moneromooo-monero 8261ba69e6
readline_buffer: fix busy wait
It'd eat up a core constantly, due to spending its time jumping
back and forth between userland and kernel. We now wait for up
to a millisecond in kernel, which will be transparent to the user
and drop to idle most of the time.
2017-06-23 13:21:50 +01:00
moneromooo-monero 21b939e1e6
readline: fix invalid memory access
m_cout_buf was not initialized
2017-06-21 17:33:47 +01:00
moneromooo-monero 5f8f290505
readline_buffer: add a couple const 2017-06-21 17:33:30 +01:00
kenshi84 007937e217
net_utils_base: added missing template keyword 2017-06-19 08:11:28 +09:00
jethro e1f3dfccc8 Add readline support to cli
This PR adds readline support to the daemon and monero-wallet-cli. Only
GNU readline is supported (e.g. not libedit) and there are cmake checks
to ensure this.

There is a cmake variable, Readline_ROOT_DIR that can specify a
directory to find readline, otherwise some default paths are searched.

There is also a cmake option, USE_READLINE, that defaults to ON. If set
to ON, if readline is not found, the build continues but without
readline support.

One negative side effect of using readline is that the color prompt in
the wallet-cli now has no color and just uses terminal default. I know
how to fix this but it's quite a big change so will tackle another time.
2017-06-18 10:08:37 -04:00
Riccardo Spagni a237f90c5b
Merge pull request #2052
072102cf abstracted nework addresses (moneromooo-monero)
2017-06-18 14:23:59 +02:00
Howard Chu 07c4276cbe
Don't issue a new timedsync while one is already in progress
A timedsync is issued every minute on a connection, but the input
tineout is 2 minutes. This means a new sync request could be issued
while a slow sync request was already in progress. The additional
request will further clog the network on a slow connection, and
cause a premature timeout.
2017-06-15 16:54:03 +01:00
Howard Chu cf3a376cb5
Don't timeout a slow operation that's making progress
If we got at least MIN_BYTES_WANTED (default 512) during any network
poll, reset the timeout to allow more time for data to arrive.
2017-06-15 16:54:03 +01:00
Howard Chu 340830de5b
Fix PR#2039
Missed a crypto -> cncrypto rename
2017-06-15 16:54:03 +01:00
Howard Chu fa489a26ef
Fix PR#2039
Missed a crypto -> cncrypto rename
2017-05-31 15:34:31 +01:00
moneromooo-monero 072102cfd2
abstracted nework addresses
All code which was using ip and port now uses a new IPv4 object,
subclass of a new network_address class. This will allow easy
addition of I2P addresses later (and also IPv6, etc).
Both old style and new style peer lists are now sent in the P2P
protocol, which is inefficient but allows peers using both
codebases to talk to each other. This will be removed in the
future. No other subclasses than IPv4 exist yet.
2017-05-27 11:35:54 +01:00
stoffu dd8e3266b2
shared libs build (i.e. make debug) 2017-05-17 10:17:08 +09:00
Lee Clagett 7199fc8373 Removed some unused epee functions 2017-04-25 16:07:32 -04:00
Lee Clagett 93e10f1cc4 Simplified the implementation and features of span 2017-04-11 16:35:14 -04:00
Lee Clagett 4a8f96f95d Improvements for epee binary to hex functions:
- Performance improvements
  - Added `span` for zero-copy pointer+length arguments
  - Added `std::ostream` overload for direct writing to output buffers
  - Removal of unused `string_tools::buff_to_hex`
2017-04-11 16:35:00 -04:00
Riccardo Spagni de68b00596
Merge pull request #1948
62efe5f6 mlog: direct log category changes to file only (moneromooo-monero)
2017-04-11 00:24:08 +02:00
moneromooo-monero a28950da73
setThreadName moved in new version of easylogging++ 2017-04-10 21:05:56 +01:00
moneromooo-monero a8ac4f0a70
update easylogging++ to latest upstream 2017-04-10 21:05:02 +01:00
moneromooo-monero 62efe5f656
mlog: direct log category changes to file only
Because some people just won't even try to read what is written
and freak out because the word FATAL is in here, despite the
context making it clear it's not an error.
2017-04-01 11:29:43 +01:00
Lee Clagett 287ef36ed8 Fix freebsd build 2017-03-21 10:41:21 -04:00
Riccardo Spagni a85f750ee8
Merge pull request #1893
0effe196 Revert "Increase the log level for the info about log levels" (moneromooo-monero)
2017-03-19 22:59:26 +02:00
moneromooo-monero 0effe196e4
Revert "Increase the log level for the info about log levels"
We want to know which log categories are active.

This reverts commit 4f7bce6d20.
2017-03-19 09:39:28 +00:00
Lee Clagett 50cd179a60 Removed boost/asio.hpp include from epee/string_tools.h 2017-03-18 22:05:14 -04:00
moneromooo-monero 9bf017edf2
http_client: allow cancelling a download 2017-03-05 16:23:34 +00:00
moneromooo-monero 0d90123cac
http_client: allow derived class to get headers at start 2017-03-05 16:23:29 +00:00
Riccardo Spagni e10bf1d6c0
Merge pull request #1805
b7f85a30 mlog: default net.cn to FATAL (moneromooo-monero)
2017-03-03 14:12:21 +02:00
moneromooo-monero b7f85a30cd
mlog: default net.cn to FATAL
Errors in this layer depend on how peers behave, and thus errors
are expected
2017-02-26 11:02:05 +00:00
Nano Akron 4f7bce6d20
Increase the log level for the info about log levels 2017-02-25 14:58:18 +00:00
Lee Clagett 8c84d48caa Updated default RPC timeout from 5 seconds to 15 seconds 2017-02-24 12:55:17 -05:00
Riccardo Spagni 3ac5a785e0
Merge pull request #1762
dcf684c7 http_server_impl_base: set bind message to MGINFO (anonimal)
2017-02-22 09:37:05 +02:00
Riccardo Spagni 1a4298685a
Merge pull request #1766
72deb484 updated fallback nodes (Riccardo Spagni)
33329f5b update version to 0.10.2 (Riccardo Spagni)
04a50a7e update checkpoints.dat (Riccardo Spagni)
c3599fa7 update copyright year, fix occasional lack of newline at line end (Riccardo Spagni)
2017-02-22 09:36:11 +02:00
anonimal dcf684c704
http_server_impl_base: set bind message to MGINFO 2017-02-21 18:30:43 +00:00
Riccardo Spagni c3599fa7b9
update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00
moneromooo-monero 56586bde9e
mlog: restrict net.p2p to FATAL by default 2017-02-21 17:37:03 +00:00
moneromooo-monero 4bf7849297
mlog: only silence errors for net by default, not net.* 2017-02-20 22:58:29 +00:00
moneromooo-monero efb72e74e2
http_client: add a couple consts 2017-02-20 22:58:21 +00:00
Riccardo Spagni e246dd1443
Merge pull request #1717
8bdc86be protocol: speed up sync by minimizing duplicate work (moneromooo-monero)
61dfa310 epee: fix some log macros not printing context nicely (moneromooo-monero)
2017-02-12 23:28:38 +02:00
Riccardo Spagni 4e7bcad58f
Merge pull request #1713
422ecc98 Fixup choice of easylogging++ vs libunwind stack trace code (moneromooo-monero)
2017-02-12 23:25:42 +02:00
moneromooo-monero 61dfa310d7
epee: fix some log macros not printing context nicely 2017-02-12 17:16:11 +00:00
moneromooo-monero 422ecc98e4
Fixup choice of easylogging++ vs libunwind stack trace code 2017-02-12 13:59:21 +00:00
moneromooo-monero 3b6839cc96
mlog: move log level changes to global level
Makes it more likely to show up
2017-02-12 11:45:22 +00:00
moneromooo-monero 28d0b11fde
mlog: s/Mew/New/ in log 2017-02-12 11:35:04 +00:00
Riccardo Spagni 9ed3e1bb6a
Merge pull request #1693
5d00659e disable ELPP_STACKTRACE_ON_CRASH for android (MoroccanMalinois)
2017-02-11 00:40:17 +02:00
Riccardo Spagni eacf2124b6 Merge pull request #1689
ce7fcbb4 Add server auth to monerod, and client auth to wallet-cli and wallet-rpc (Lee Clagett)
2017-02-11 00:35:25 +02:00
kenshi84 8027ce0c75 extract some basic code from libcryptonote_core into libcryptonote_basic 2017-02-08 22:45:15 +09:00
Lee Clagett ce7fcbb4ae Add server auth to monerod, and client auth to wallet-cli and wallet-rpc 2017-02-06 01:15:41 -05:00
MoroccanMalinois 5d00659e1d disable ELPP_STACKTRACE_ON_CRASH for android 2017-02-06 05:14:15 +00:00
Riccardo Spagni 9547e79af5
Merge pull request #1670
c3d7a198 mlog: probable fix for gmtime_r not being available on windows (moneromooo-monero)
2017-02-04 17:28:23 +02:00
Riccardo Spagni 5da4650cba
Merge pull request #1671
cd34fc65 Use easylogging++'s stack trace facility where possible (moneromooo-monero)
2017-02-04 17:27:54 +02:00
moneromooo-monero cbdfa7576a
mlog: fix default logging being not verbose enough 2017-02-04 12:43:19 +00:00
moneromooo-monero cd34fc655d
Use easylogging++'s stack trace facility where possible
This avoids using libunwind, which often causes trouble.
2017-02-04 12:33:03 +00:00
moneromooo-monero c3d7a198bf
mlog: probable fix for gmtime_r not being available on windows 2017-02-04 11:48:58 +00:00
Riccardo Spagni 5fb3f97a55
Merge pull request #1629
c02e1cb9 Updates to epee HTTP client code   - http_simple_client now uses std::chrono for timeouts   - http_simple_client accepts timeouts per connect / invoke call   - shortened names of epee http invoke functions   - invoke command functions only take relative path, connection     is not automatically performed (Lee Clagett)
2017-02-02 19:32:01 +02:00
Jaquee aa9561909a
GUI: Add install target for epee 2017-01-30 23:29:05 +01:00
Lee Clagett c02e1cb943 Updates to epee HTTP client code
- http_simple_client now uses std::chrono for timeouts
  - http_simple_client accepts timeouts per connect / invoke call
  - shortened names of epee http invoke functions
  - invoke command functions only take relative path, connection
    is not automatically performed
2017-01-25 15:39:32 -05:00
moneromooo-monero 1e8cc6764e
mlog: allow using numerical level as default prefix
eg, 2,foo:ERROR,bar:INFO
2017-01-22 16:54:17 +00:00
Riccardo Spagni cccf4b9889
Merge pull request #1613
13dd102e mlog: fix default level/category mapping (moneromooo-monero)
2017-01-22 11:50:04 -05:00
Riccardo Spagni e12f073f65
Merge pull request #1604
a854cec3 Make stack trace show up in log file with default settings (moneromooo-monero)
2017-01-22 11:41:38 -05:00
Riccardo Spagni ab9c287d92
Merge pull request #1597
4d6976fb undelete epee tests.cpp (moneroexamples)
0fd2508b removing some unsed epee files (moneroexamples)
2017-01-22 11:37:46 -05:00
moneromooo-monero 13dd102e94
mlog: fix default level/category mapping
It was not matching the LOG_PRINT_Lx mapping for 2/3/4
2017-01-22 15:20:55 +00:00
moneromooo-monero a854cec3ba
Make stack trace show up in log file with default settings 2017-01-21 20:28:18 +00:00
moneroexamples 4d6976fbce undelete epee tests.cpp 2017-01-21 10:00:32 +08:00
moneroexamples 0fd2508b89 removing some unsed epee files 2017-01-20 01:05:14 +00:00
moneromooo-monero 5e61687fdf
mlog: allow overriding log format
using the MONERO_LOG_FORMAT environment variable.

Default is:
%datetime{%Y-%M-%d %H:%m:%s.%g}\t%thread\t%level\t%logger\t%loc\t%msg

Field list in easylogging++ documentation.

Don't forget to escape as needed.
2017-01-16 19:43:00 +00:00
moneromooo-monero 5833d66f65
Change logging to easylogging++
This replaces the epee and data_loggers logging systems with
a single one, and also adds filename:line and explicit severity
levels. Categories may be defined, and logging severity set
by category (or set of categories). epee style 0-4 log level
maps to a sensible severity configuration. Log files now also
rotate when reaching 100 MB.

To select which logs to output, use the MONERO_LOGS environment
variable, with a comma separated list of categories (globs are
supported), with their requested severity level after a colon.
If a log matches more than one such setting, the last one in
the configuration string applies. A few examples:

This one is (mostly) silent, only outputting fatal errors:

MONERO_LOGS=*:FATAL

This one is very verbose:

MONERO_LOGS=*:TRACE

This one is totally silent (logwise):

MONERO_LOGS=""

This one outputs all errors and warnings, except for the
"verify" category, which prints just fatal errors (the verify
category is used for logs about incoming transactions and
blocks, and it is expected that some/many will fail to verify,
hence we don't want the spam):

MONERO_LOGS=*:WARNING,verify:FATAL

Log levels are, in decreasing order of priority:
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE

Subcategories may be added using prefixes and globs. This
example will output net.p2p logs at the TRACE level, but all
other net* logs only at INFO:

MONERO_LOGS=*:ERROR,net*:INFO,net.p2p:TRACE

Logs which are intended for the user (which Monero was using
a lot through epee, but really isn't a nice way to go things)
should use the "global" category. There are a few helper macros
for using this category, eg: MGINFO("this shows up by default")
or MGINFO_RED("this is red"), to try to keep a similar look
and feel for now.

Existing epee log macros still exist, and map to the new log
levels, but since they're used as a "user facing" UI element
as much as a logging system, they often don't map well to log
severities (ie, a log level 0 log may be an error, or may be
something we want the user to see, such as an important info).
In those cases, I tried to use the new macros. In other cases,
I left the existing macros in. When modifying logs, it is
probably best to switch to the new macros with explicit levels.

The --log-level options and set_log commands now also accept
category settings, in addition to the epee style log levels.
2017-01-16 00:25:46 +00:00
Riccardo Spagni ec323d8c3f
Merge pull request #1561
d561f4ad enable clang checks that were disabled (Chris Vickio)
0aefb2f6 remove std::move from return statements (pessimizing-move warning) (Chris Vickio)
629d5b76 change counter from bool to int (deprecated-increment-bool warning) (Chris Vickio)
fb76d439 add extra braces around subobjects (missing-braces warning) (Chris Vickio)
3b6d5f25 make struct/class declarations consistent (mismatched-tags warning) (Chris Vickio)
fcf66925 remove unused fields from network_throttle (unused-private-field warning) (Chris Vickio)
296f8c16 inline unused function (for unused-function warning) (Chris Vickio)
2017-01-15 19:01:08 -05:00
Chris Vickio 296f8c160f inline unused function (for unused-function warning) 2017-01-14 13:37:14 +03:00
Lee Clagett d81cb08704 Added (not yet enabled) HTTP client authentication 2017-01-11 03:21:17 -05:00
Riccardo Spagni 866463f37b
Merge pull request #1514
fa0ee42c Workarounds for gcc 4.8 (Lee Clagett)
2017-01-08 16:41:03 -08:00
MoroccanMalinois 80abc3bc4a Build wallet with Android NDK 2017-01-05 01:11:05 +00:00
Lee Clagett fa0ee42cc9 Workarounds for gcc 4.8 2016-12-30 02:14:06 -05:00
Lee Clagett bdc3d7496f Adding HTTP Digest Auth (but not yet enabled) 2016-12-13 00:19:54 -05:00
Riccardo Spagni 45bb393577
Merge pull request #1403
60633cf6 Spelling in errors (taushet)
2016-12-04 22:30:15 +02:00
Riccardo Spagni 977dd9b76c
Merge pull request #1385
5783dd8c tests: add unit tests for uri parsing (moneromooo-monero)
82ba2108 wallet: add API and RPC to create/parse monero: URIs (moneromooo-monero)
d9001b43 epee: add functions to convert from URL format (ie, %XX values) (moneromooo-monero)
2016-12-04 22:19:06 +02:00
taushet 60633cf674 Spelling in errors 2016-12-04 20:12:40 +01:00
moneromooo-monero d9001b43ac
epee: add functions to convert from URL format (ie, %XX values) 2016-11-28 17:54:16 +00:00
moneromooo-monero c3527dafd5
epee: signal cond var before unlocking
This is more canonical, and avoids some helgrind spam
2016-11-28 09:52:49 +00:00
Riccardo Spagni c36cb54340
Merge pull request #1372
17b6bd6 Fix DNS failures in offline mode preventing daemon startup (moneromooo-monero)
2016-11-24 13:01:35 +02:00
moneromooo-monero 17b6bd6d35
Fix DNS failures in offline mode preventing daemon startup 2016-11-23 23:14:49 +00:00
moneromooo-monero 452aeca5cd
epee: blind attempt to fix exit hang on windows
Thanks to duckduckgo and the internet.

This might even compile.
2016-11-17 22:10:03 +00:00
moneromooo-monero cd929b89b0
levin: fix wrong value passed as return code to remote call
When receiving an answer packet, the command code was passed
to the callback instead of the error code. This was hiding
the "command not found" failure from the peer, and in turn
causing the code to attempt to deserialize a non existent
reply string.
2016-11-12 10:12:23 +00:00
Lee Clagett 4869db702a adding static_assert to pod functions in string tools 2016-10-31 13:22:21 -04:00
NanoAkron d28db2368e
Unkonown -> unknown 2016-10-27 23:07:37 +01:00
NanoAkron 6390673137 Removed all code related to fast_exit 2016-10-03 02:06:55 +01:00
moneromooo-monero eeb2bbc0fc
epee: optionally restrict HTTP service to a configurable user agent
This is intended to catch traffic coming from a web browser,
so we avoid issues with a web page sending a transfer RPC to
the wallet. Requiring a particular user agent can act as a
simple password scheme, while we wait for 0MQ and proper
authentication to be merged.
2016-09-18 20:32:02 +01:00
moneromooo-monero 0d7ce00793
epee: do not try network resolution if loopback worked
Fixes the wallet being unable to connect to the daemon
when there is no NIC.
2016-09-01 18:12:39 +01:00
Riccardo Spagni 18fa01c092
Merge pull request #884
c2ad9ca allow peers without port (moneromooo-monero)
2016-07-06 18:20:17 +02:00
moneromooo-monero c2ad9caf01
allow peers without port
The default port is then used
2016-07-03 12:51:12 +01:00
redfish 72287d121a contrib: epee: add missing noexcept spec to class decl
The noexcept specs were added to make GCC 6.1.1 happy (#846), but this
one was missing (because GCC did not complain about it on Linux, but
does complain on OSX).
2016-06-22 09:05:53 -04:00
Riccardo Spagni 2072c642d1
Merge pull request #862
5dc09f2 wallet_rpc_server: fix some string values being returned between <> (moneromooo-monero)
f8213c0 Require 64/16 characters for payment ids (moneromooo-monero)
2016-06-19 21:51:32 +02:00
moneromooo-monero f8213c0644
Require 64/16 characters for payment ids
The default behavior for hex string parsing would allow the
last digit to be made from a single hexadecimal character,
which is correct, but we typically do not want that as it
gets confusing and easy to not spot wrong input size.
2016-06-19 17:52:39 +01:00
redfish c2d7300d2e contrib: epee: add exception spec to throwing destructors
The destructors get a noexcept(true) spec by default, but these
destructors in fact throw exceptions. An alternative fix might be to not
throw (most if not all of these throws are non-essential
error-reporting/logging).
2016-05-18 01:02:27 -04:00
Riccardo Spagni f03def87ad
Merge pull request #840
1c0bffb Restrict also 'get_connections' and 'getbans' APIs. (osensei)
9f8bc49 Don't allow 'flush_txpool' and 'setbans' JSON_RPC methods when running in restricted mode. (osensei)
2016-05-17 19:09:11 +02:00