Commit graph

19 commits

Author SHA1 Message Date
Calin Culianu
9e224af988 Added error messgae RPC handlign in EXMgr (just prints a warning) 2019-04-30 19:42:22 +03:00
Calin Culianu
faeb64207f Finally.. finished refactoring out the RPC bits.
Now we can re-use the RPC method<->result code in the TcpServer side
which will face wallets.  Phew!  Took me long enough!

It's a minimal JSON-RPC protocol impl.. but it'll do.

The 1 nice bit is the Schema spec I came up with which more-or-less
works well enough as a first-pass validatior.

Further passes are needed in interested client code, but the initial
pass validation can be done in a thread so as to not waste the main
thread's time validating json or dict key presence/absense. Yay.
2019-04-30 19:21:47 +03:00
Calin Culianu
463b3d00b9 intermediate commit 2019-04-30 13:18:05 +03:00
Calin Culianu
4bd954a390 intermediate commit.. about to refactor exclient more 2019-04-30 10:01:21 +03:00
Calin Culianu
dd7fdcc9e0 Added IdMixin mixin 2019-04-28 11:06:50 +03:00
Calin Culianu
9fc0343b45 Refactored out the worker-thread paradigm thing we use
Into a pure mixin class called "ThreadObjectMixin".

TODO: make the TcpServer also use this mixin.
2019-04-28 10:27:17 +03:00
Calin Culianu
e08588ca51 Refactored a little
- the 'id' is now app-global and lives in App.h
- Mgr::stats() now returns a VariantMap
2019-04-27 19:58:42 +03:00
Calin Culianu
2e24899d26 Made EX server picking truly a random shuffle
Picks from extant servers randomly.

Also small nits.
2019-04-27 13:28:48 +03:00
Calin Culianu
3f49dce1db Added some small goodies
- Util::RunInThread to run a lambda in a thread
- App exit handling cleanup
- EXMgr uses an id for clients now
- EXMgr keeps track of lagging clients
- EXMgr more aggressive with reconnects if no valid exclients
- Nits and refactorings and misc. cleanup
2019-04-27 12:38:50 +03:00
Calin Culianu
e65bacd7fd Petit refactoring
- Made the stale timeout be 2 mins now
- Check clients runs every 1 minute
- Added 'Controller' ABC which EXMgr is one of and the TcpServer will be
another.
2019-04-26 06:23:49 +03:00
Calin Culianu
dcc2212348 tweak 2019-04-24 17:10:38 +03:00
Calin Culianu
3721baf3bb Moved reqid generation from EXClient to EXMgr
This is probably where it belongs. Will allow us to track requests to the
ElectrumX server better as we implement more of this server.
2019-04-24 10:57:11 +03:00
Calin Culianu
57148960c4 Added some command line options and a command line parser 2019-04-23 23:26:07 +03:00
Calin Culianu
0c51a34190 Fixups to fix crash
We weren't exactly thread safe. Fixed to not touch socket from main
thread. Also documented what should be called from which thread.
Hopefully we are solid now.
2019-04-23 21:51:53 +03:00
Calin Culianu
3aec346c74 Tweak to prevent leaking idMethodMap if bad server 2019-04-23 19:20:48 +03:00
Calin Culianu
2db4d09705 implemented checkClients (maintain EXClients) 2019-04-23 18:49:36 +03:00
Calin Culianu
58461e7890 implemented 3 electrum x protocol commands. getting there. 2019-04-23 16:24:18 +03:00
Calin Culianu
4637012e22 Added more EXClient stuff 2019-04-23 12:36:51 +03:00
Calin Culianu
62101beeac Initial revision. Just laying out a skeleton to build on. 2019-04-23 02:33:16 +03:00