Commit Graph

259 Commits

Author SHA1 Message Date
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
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
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
moneroexamples
0fd2508b89 removing some unsed epee files 2017-01-20 01:05:14 +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
osensei
9f8bc4946b Don't allow 'flush_txpool' and 'setbans' JSON_RPC methods when running in restricted mode. 2016-05-14 03:06:04 -03:00
moneromooo-monero
d6bce4be36
core: move tx_extra parsing errors to log level 1
They're not fatal, though indicate something wrong
2016-05-01 11:35:06 +01:00
moneromooo-monero
3102feb56c
abstract_tcp_server2: fix send queue limit warning spam
When the send queue limit is reached, it is likely to not drain
any time soon. If we call close on the connection, it will stay
alive, waiting for the queue to drain before actually closing,
and will hit that check again and again. Since the queue size
limit is the reason we're closing in the first place, we call
shutdown directly.
2016-04-17 11:47:22 +01:00
moneromooo-monero
6bca9a8ef4
abstract_tcp_server2: avoid deadlock waiting for send queue to drain
If we reach the send queue size limit, we need to release the lock,
or we will deadlock and it will never drain.

If we reach that limit, it's likely there's another problem in the
first place though, so it will probably not drain in practice either,
unless some kind of transient network timeout.
2016-04-17 11:45:38 +01:00
Riccardo Spagni
abea280dd3
Merge pull request #799
aaaf9e2 Fix get_tick_count() on Windows (Howard Chu)
2016-04-06 12:21:14 +09:00
Howard Chu
aaaf9e2e6d Fix get_tick_count() on Windows
GetTickCount used in 52056dcfc4
only has ~10-16ms resolution. Use higher rez timer to get 1ms rez.
2016-04-06 03:41:52 +01:00
moneromooo-monero
b1aaf20e57
epee: flush output after a message
This is equivalent to line buffering, as C++ seems to lack
a setvbuf equivalent which alows line buffering.
2016-04-02 20:59:24 +01:00
moneromooo-monero
43962f4103
abstract_tcp_server2: possible fix for exception in handle_accept 2016-03-27 12:53:20 +01:00
Riccardo Spagni
51a56e78ae
remove unecessary and bad std::move from portable_storage_template_helper.h 2016-03-25 14:33:58 +02:00
moneromooo-monero
f7301c3563
Revert "Print stack trace upon exceptions"
Ain't nobody got time for link/cmake skullduggery.

This reverts commit fff238ec94.
2016-03-21 10:12:23 +00:00
Riccardo Spagni
f6317ec1c0
Merge pull request #736
2b4cab3 epee: fix potential hang on exit (moneromooo-monero)
2016-03-20 21:28:11 +02:00
moneromooo-monero
2b4cab30fc
epee: fix potential hang on exit
Also close sockets on failure, just in case
2016-03-20 12:05:55 +00:00
moneromooo-monero
fff238ec94
Print stack trace upon exceptions
Useful for debugging users' logs
2016-03-19 21:48:36 +00:00
moneromooo-monero
e98b26a87e
epee: fix bug deleting more than one connection at once 2016-03-12 15:36:18 +00:00
Riccardo Spagni
dfd0e9c97d
Merge pull request #712
66c2fc7 Need to link boost::chrono in more places now (Howard Chu)
b937a2c Use boost::thread instead of std::thread (Howard Chu)
2016-03-11 20:15:10 +02:00
Howard Chu
52056dcfc4 WIN32 thread_id is OS-dependent not compiler-dependent 2016-03-11 15:46:09 +00:00
Howard Chu
b937a2c915 Use boost::thread instead of std::thread
and all other associated IPC
2016-03-11 15:09:50 +00:00
moneromooo-monero
5e3557d2c3
move g_test_dbg_lock_sleep from a global to a function level static
This avoids the need to define that variable in every program
which uses epee.
2016-02-22 19:34:09 +00:00
Howard Chu
11d555cebe Fix crash in std::map for connections_map
Use boost::unordered_map instead.
2016-02-18 21:31:30 +00:00
Howard Chu
014f8868f2 std::condvar is broken on Win32 with gcc/g++ 4.8 too
Use boost...
2016-02-18 21:31:21 +00:00
Howard Chu
7c86c5997d Use boost::thread instead of std::thread
std::thread crashes on (at least) ARMv6 g++ 4.8/4.9
2016-02-18 21:30:10 +00:00
moneromooo-monero
1402a526af
epee: always call the PRNG through the locked API 2016-02-13 20:00:44 +00:00
moneromooo-monero
d97582cf95
epee: use generate_random_bytes for new random uuids
Instead of using boost::uuids::generate_random, which uses
uninitialized stuff *on purpose*, just to annoy people who
use valgrind
2016-01-30 18:45:53 +00:00
moneromooo-monero
17c7c9caed
epee: remove dodgy random code that nobody uses
in case someone might want to use it
2016-01-30 18:45:22 +00:00
Riccardo Spagni
153fe0cb75
Merge pull request #622
e514f0a even more typos (Henning Kopp)
9abc4b8 more typos fixed (Henning Kopp)
0693f3c fixed typo (Henning Kopp)
2016-01-25 19:39:07 +02:00
Henning Kopp
9abc4b831b more typos fixed 2016-01-25 13:42:44 +01:00
me0wmix
28f95eb001 OpenBSD support for Monero. 2016-01-21 11:18:26 -07:00
Howard Chu
a561afa18b ARM chars are unsigned 2016-01-03 11:57:35 +00:00
Howard Chu
ee6f2cb71f IP_TOS not supported before Windows7 2016-01-02 03:10:41 +00:00
moneromooo-monero
22581a0441
epee: regularly cleanup connections we kept a reference to
Since connections from the ::connect method are now kept in
a deque to be able to cancel them on exit, this leaks both
memory and a file descriptor. Here, we clean those up after
30 seconds, to avoid this. 30 seconds is higher then the
5 second timeout used in the async code, so this should be
safe. However, this is an assumption which would break if
that async code was to start relying on longer timeouts.
2015-12-23 11:19:16 +00:00
moneromooo-monero
1e2f2d7da0
epee: fix hang on exit
When the boost ioservice is stopped, pending work notifications
will not happen. This includes deadline timers, which would
otherwise time out the now cancelled I/O operations. When this
happens just after starting a new connect operation, this can
leave that operations in a state where it won't receive either
the completion notification nor a timeout, causing a hang.

This is fixed by keeping a list of connections corresponding
to the connect operations, and cancelling them before stopping
the boost ioservice.

Note that the list of these connections can grow unbounded, as
they're never cleaned up. Cleaning them up would involve
working out which connections do not have any pending work,
and it's not quite clear yet how to go about this.
2015-12-22 12:39:02 +00:00
moneromooo-monero
760331b427
epee: make log macros behave like statements
In particular, make this kind of thing do what one expects
it to do:

if (x) LOG_PRINT("True"); else LOG_PRINT("No");
2015-12-19 14:48:52 +00:00
moneromooo-monero
4cede1830e
console_handler: catch exception inside the input loop
This prevents an exception from existing the loop without
calling the exit handler, if one is defined.
The daemon defines one, which stops the p2p layer, and will
only exit once the p2p layer is shut down. This would cause
a hang upon an exception, as the input thread would have
exited and the daemon would wait forever with no console
user input.
2015-12-06 22:03:53 +00:00
Riccardo Spagni
bc1bc4adb2
Merge pull request #507
62e49a5 wallet: optional automatic refresh from the daemon (moneromooo-monero)
2015-11-30 00:19:47 +02:00
moneromooo-monero
62e49a5f02
wallet: optional automatic refresh from the daemon
The daemon will be polled every 90 seconds for new blocks.
It is enabled by default, and can be turned on/off with
set auto-refresh 1 and set auto-refresh 0 in the wallet.
2015-11-28 12:41:06 +00:00
moneromooo-monero
75742977a8
core_rpc_server: add a --restricted-rpc option
It does not expose the RPC for commands like start_mining, etc
(ie, commands a public node operator might want to be restricted)
2015-11-27 18:27:24 +00:00
Javier Smooth
4cea2b13b2 Add IP blocking for misbehaving nodes (adapted from Boolberry)
With minor cleanup and fixes (spelling, indent) by moneromooo
2015-11-23 18:06:20 +00:00
moneromooo-monero
1980d8ebfa
console_handler: silence spurious message when exiting daemon
The daemon registers a custom exit command, which cause the
loop to stop. Catch this case before printing "Failed to read line"
as this is an expected case.
2015-10-21 19:57:34 +01:00
warptangent
b5b0f0857a
epee: Don't set log file name when process path name isn't found
If process path name isn't found, then leave log file name blank.

This also applies if a process name is found, but it's blank after
removing a trailing dot extension.
2015-08-16 18:45:45 -07:00
moneromooo-monero
e0278314d3
console_handler: do not call a NULL function pointer
The exit_handler can be NULL.
2015-07-18 10:53:49 +01:00
moneromooo-monero
b87e066f02
console_handler: check for eof before trying to use input
We'll get there without input if we exited
2015-07-18 10:48:46 +01:00
moneromooo-monero
35b160edea
fix ^D exit for bitmonerod
It uses the async console handler differently than simplewallet,
and wasn't running the same exit code, causing it to never actually
exit after breaking out of the console entry loop.
2015-06-03 22:43:35 +01:00
moneromooo-monero
87c01c30f3
console_handler: handle EOF properly
Exit instead of reading "empty" commands in an infinite loop.
2015-05-30 19:25:07 +01:00
warptangent
696225321f
Fix compile for GCC 5.1.0
Add fix for compile error with multiple uses of peerid_type (uint64_t)
variable in lambda expression.
- known GCC issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65843

epee: replace return value of nullptr for expected boolean with false.

Fixes #231.
2015-05-25 22:18:36 -07:00
rfree2monero
32c19c6c3d
[fix] log level change. compilation: dns, tests
old unbound #warning does not block compilation
unit tests build fine. Even though the RPC/P2P network type is required again
2015-04-10 16:54:21 +02:00
rfree2monero
9bfa593eee [fix] Network 1.8: unlimited the RPC connections
works for unit tests build, too
2015-04-08 19:54:07 +02:00
rfree2monero
44f423477a [fix] mac os x includes std::random... 2015-04-01 20:25:53 +02:00
rfree2monero
c511abf005 remerged; commands JSON. logging upgrade. doxygen 2015-04-01 19:00:45 +02:00
rfree2monero
3cbdf198f1 Merge remote-tracking branch 'monero-official/master' into network-1.6-work1 2015-04-01 18:24:45 +02:00
Thomas Winget
a0590d29cd
Restore daemon interactive mode
Daemon interactive mode is now working again.

RPC mapped calls in daemon and wallet have both had connection_context
removed as an argument as that argument was not being used anywhere.
2015-03-27 08:01:30 -04:00
Thomas Winget
9193d6fb5b
Daemonize changes pulled in -- daemon builds
many RPC functions added by the daemonize changes
(and related changes on the upstream dev branch that were not merged)
were commented out (apart from return).  Other than that, this *should*
work...at any rate, it builds, and that's something.
2015-02-24 00:05:19 -05:00
rfree2monero
ae2a50659f 2014 network limit 1.2 +utils +toc -doc -drmonero
new update of the pr with network limits

more debug options:
discarding downloaded blocks all or after given height.
trying to trigger the locking errors.

debug levels polished/tuned to sane values.
debug/logging improved.

warning: this pr should be correct code, but it could make
an existing (in master version) locking error appear more often.

it's a race on the list (map) of peers, e.g. between closing/deleting
them versus working on them in net-limit sleep in sending chunk.

the bug is not in this code/this pr, but in the master version.

the locking problem of master will be fixed in other pr.

problem is ub, and in practice is seems to usually cause program abort
(tested on debian stable with updated gcc). see --help for option
to add sleep to trigger the error faster.
2015-02-20 22:28:03 +01:00
rfree2monero
0f06dca831 fixed size_t on windows
thought it was already fixed, apparently commit got lost somewhere
2015-02-20 22:13:00 +01:00
rfree2monero
5ce4256e3d 2014 network limit 1.1 +utils +toc -doc -drmonero
Update of the PR with network limits

works very well for all speeds
(but remember that low download speed can stop upload
because we then slow down downloading of blockchain
requests too)

more debug options

fixed pedantic warnings in our code
should work again on Mac OS X and FreeBSD
fixed warning about size_t
tested on Debian, Ubuntu, Windows(testing now)

TCP options and ToS (QoS) flag
FIXED peer number limit
FIXED some spikes in ingress/download
FIXED problems when other up and down limit
2015-02-20 22:13:00 +01:00
rfree2monero
eabb519605 2014 network limit 1.0a +utils +toc -doc -drmonero
commands and options for network limiting
works very well e.g. for 50 KiB/sec up and down
ToS (QoS) flag
peer number limit
TODO some spikes in ingress/download
TODO problems when other up and down limit
added "otshell utils" - simple logging (with colors, text files channels)
2015-02-20 22:13:00 +01:00
Riccardo Spagni
f4b69d553a
year updated in license 2015-01-02 18:52:46 +02:00
Riccardo Spagni
e3d24002c1
forgot to add connection context to log line 2014-10-02 19:43:21 +02:00
Riccardo Spagni
0e1b7c9999
moved non-critical p2p errors to l2 2014-10-02 19:15:58 +02:00
Riccardo Spagni
99945a5c47
dependencies enforced, send que error message log level moved 2014-09-29 20:13:15 +02:00
Riccardo Spagni
fdae09754e increase ABSTRACT_SERVER_SEND_QUE_MAX_COUNT to a more sane value 2014-09-15 15:41:07 +02:00
fluffypony
cf5a8b1d6c moved non-critical warnings and errors to log level 1 2014-09-09 11:32:00 +02:00
fluffypony
32f9d2b783 move modified epee code to new classes, revert license 2014-07-25 18:29:08 +02:00
fluffypony
6fc995fe5d License updated to BSD 3-clause 2014-07-23 15:03:52 +02:00
Thomas Winget
a521046ff2 Fixed console handler not properly exiting on SIGINT and such 2014-06-13 00:09:09 -04:00
fluffypony
240fce29d8 removed continue issue 2014-06-06 19:06:28 +02:00
fluffypony
e0685d412a don't fall apart if you can't get_line 2014-06-04 22:53:54 +02:00
mydesktop
0eba4e0442 extra files 2014-05-25 13:34:31 -04:00
mydesktop
3a3a817678 0.8.8update 2014-05-25 13:06:40 -04:00
mydesktop
333f975760 initial [broken] update 2014-05-03 12:19:43 -04:00
mydesktop
79a4bedc36 mac osx building fixes 2014-04-30 16:50:06 -04:00
mydesktop
67df296650 various fixes to allow mac osx compilation 2014-04-30 13:52:21 -04:00
Antonio Juarez
a401a02ddb Improvements in JSON RPC 2014-04-07 16:02:15 +01:00
Antonio Juarez
29c2859a3e json rpc for wallet and bugfix 2014-04-02 17:00:17 +01:00
Antonio Juarez
8efa1313f3 some fixes 2014-03-20 11:46:11 +00:00
Antonio Juarez
296ae46ed8 moved all stuff to github 2014-03-03 22:07:58 +00:00