Commit Graph

269 Commits

Author SHA1 Message Date
Jason Rhinelander ed9af92411 Fix reply_tag off-by-one 2020-02-20 20:23:16 -04:00
Jason Rhinelander de0a5842af Added debugging around pending request creation/removal 2020-02-20 20:13:29 -04:00
Jason Rhinelander 5d30846cee Disable non-working self-connection inproc socket
This was meant to be an optimization but doesn't actually work because
we don't do a ZAP request at all when connecting inproc sockets, so the
metadata we need never gets set.

Remove it so a SN can still connect to itself.
2020-02-17 17:59:01 -04:00
Jason Rhinelander 58e45db996 Fix truncated pubkey
Fix bug from quorumnet transition; quorumnet set the user id to
something like "S:abc..." or "C:abc..." to indicate SN or non-SN, but
now that gets carried in a separate message property but the +2 on the
copying position was still erroneously being used.
2020-02-16 22:42:03 -04:00
Jason Rhinelander b11d2870bd Fix verify pubkey initialization 2020-02-13 00:53:43 -04:00
Jason Rhinelander 98a4aed68f Fix bad string access for pubkey verification 2020-02-13 00:39:00 -04:00
Jason Rhinelander 1b6f38fc07 Add LMQ_TRACE macro instead of LMQ_LOG(trace
LMQ_TRACE becomes nothing under a release build, which is good because
many traces are in the proxy hot path.

Also fixes some confusing log level comparison logic by flipping the
order of log levels.  Previous trace < debug < info < warn, which was
confusing: now that order is reversed which makes way more sense (i.e.
larger LogLevel means more logging).
2020-02-12 22:19:18 -04:00
Jason Rhinelander 13e7953bd7 Updated headers and remove dead code 2020-02-12 22:05:15 -04:00
Jason Rhinelander ede91341da Add c++14 requirement to tests target 2020-02-11 20:39:13 -04:00
Jason Rhinelander 63e70f9912 Fix delayed proxy-scheduled batch jobs
Batch jobs scheduled by the proxy thread itself were delayed to the next
poll timeout (because nothing ever gets sent on a socket).  Add a
variable to bypass the next poll to handle this case.
2020-02-11 19:08:19 -04:00
Jason Rhinelander ccfb6d080b Add request/reply abstraction
This allows making RPC requests with a callback that gets called when
the response comes back.  The is essentially a wrapper around doing it
yourself (i.e. by setting up a server-side "request" and client-side
"reply" command where "request" responds with a "reply" command), but
abstracted into lokimq itself as it is likely to be very useful when
integrating client/server connections rather than peer-to-peer
connections.
2020-02-11 02:30:07 -04:00
Jason Rhinelander 061bdee0a8 Add zmq timer support 2020-02-11 02:29:00 -04:00
Jason Rhinelander 7393e8422c Improve on-the-fly bt deserialization interface
This separates the dict traversal into `next_...` functions that return
a key-value pair, and `consume_...` that return just the value.  The
latter is particularly useful when using `skip_until` to position
yourself at a known key.
2020-02-11 02:18:14 -04:00
Jason Rhinelander 3ff66490ad Add ability to run a batch completion job in the proxy thread
For very small jobs (i.e. just setting a flag or something) this is
going to be faster than dispatching to a thread.
2020-02-11 02:17:12 -04:00
Jason Rhinelander 63c71396be Add initial test suite with some batch job tests 2020-02-06 18:10:26 -04:00
Jason Rhinelander 03ea49167c Various small optimizations 2020-02-06 00:50:31 -04:00
Jason Rhinelander f75b6cf221 Added batch job implementation + various improvements
This overhauls the proposed batch implementation (described in the
README but previously not implemented) and implements it.

Various other minor improvements and code restructuring.

Added a proposed "request" type to the README to be implemented; this is
like a command, but always expects a ["REPLY", TAG, ...] response.  The
request invoker provides a callback to invoke when such a REPLY arrives.
2020-02-05 20:21:27 -04:00
Jason Rhinelander 8d97ba31ad Added missing CMakeLists.txt and LICENSE 2020-02-05 20:21:02 -04:00
Jason Rhinelander f3d583c520 Initial LokiMQ release
This library is adapted from lokid's existing quorumnet code (added in
6.x) used for SN-to-SN communication for quorum voting but generalized
to be usable both there and as a basis for other communication channels
with loki projects (for example: wallet-to-lokid communication; loki-ss
and lokinet internal communication with lokid; loki-ss to loki-ss
communication and message passing; perhaps eventually loki p2p traffic).

This initial release compiles but likely has a few warts and bugs that
need ironing out in the implementation before it is production ready.
Some tests will follow.
2020-02-02 22:39:26 -04:00