Commit Graph

78 Commits

Author SHA1 Message Date
Jason Rhinelander 3d315ba123 More static build linking fixes
Static linking is a dumpster fire.
2020-03-14 14:34:56 -03:00
Jason Rhinelander dd1a8eeb1d Use the correct variable for shared libs 2020-03-14 02:20:43 -03:00
Jason Rhinelander 1176b946e5 1.0.0 release 2020-03-13 21:08:34 -03:00
Jason Rhinelander ec50ee8cbd Compile libzmq statically if embedding 2020-03-13 21:08:34 -03:00
Jason Rhinelander c4d74a8640 Slightly relax build dep to 4.3
Distros (such as buster) include a patched 4.3.1, which is fine to use.
2020-03-13 19:41:08 -03:00
Jason Rhinelander 036e871cdb 32-bit warning fix 2020-03-13 19:05:12 -03:00
Jason Rhinelander 49f8ef21f1 Install mapbox-variant and cppzmq headers 2020-03-13 19:05:12 -03:00
Jason Rhinelander f7efd7f5c3 Add .gitignore 2020-03-13 17:47:40 -03:00
Jason Rhinelander a4ec2c982b Add and install pkgconfig file 2020-03-13 15:31:43 -03:00
Jason Rhinelander 4db1cd6be7 Fix lib install dir 2020-03-13 15:29:59 -03:00
Jason Rhinelander e1e8b85de6 Rearrange cmakelists.txt more logically 2020-03-13 15:29:30 -03:00
Jason Rhinelander 344fcb80d6 Disable gnu cxx extensions 2020-03-13 15:28:03 -03:00
Jason Rhinelander 4f4862fd0b Explicitly add thread linking 2020-03-13 15:27:29 -03:00
Jason Rhinelander 1f99a70f48 Build shared libraries by default
Static libraries are cursed and like to explode in bad ways.
2020-03-13 14:28:21 -03:00
Jason Rhinelander e17ca30411 Split up into logical headers and compilation units
lokimq.cpp and lokimq.h were getting monolithic; this splits lokimq.cpp
into multiple smaller cpp files by logical purpose for better parallel
compilation ability.  It also splits up the lokimq.h header slightly by
moving the ConnectionID and Message types into their own headers.
2020-03-13 14:28:21 -03:00
Jason Rhinelander 1c80b61335 Add version to cmake, generate version header 2020-03-13 14:28:05 -03:00
Jason Rhinelander 3eb6c482e1 Fix static build
Depend on cppzmq-static when doing a static build.

cppzmq-static itself has a dependency problem with libsodium, so
explicitly set the missing but required libsodium dependency on it.
2020-03-12 17:55:34 -03:00
Jason Rhinelander f4fad9c194 Fix problems on outgoing disconnect
This removes two superfluous erases that occur during connection closing
(the proxy_close_connection just above them already removes the element
from `peers`), and also short-circuits the incoming message loop if our
pollitems becomes stale so that we don't try to use a closed connection.

It also fixes a bug in the outgoing connection index that was
decrementing the wrong connection indices, leading to failures when
trying to send on an existing connection after a disconnect.

Also adds a test case (which fails before the changes in this commit) to
test this.
2020-03-10 13:54:41 -03:00
Jason Rhinelander 512086613a Build shared bundled libzmq when doing a shared build 2020-03-05 20:12:47 -04:00
Jason Rhinelander 75a3d7ff11 Add libsodium dependency
We don't necessarily get this through libzmq
2020-03-05 16:29:59 -04:00
Jason Rhinelander 279a4d3ea1 Set PIC on lokimq 2020-03-05 14:52:28 -04:00
Jason Rhinelander 0ce614ef8b Workarounds for old cmake/gcc 2020-03-05 01:33:02 -04:00
Jason Rhinelander fa7d4a8a42 Silence -Wmismatched-tags warning 2020-03-05 01:19:29 -04:00
Jason Rhinelander 443eca3955 Build a static libzmq if no system one or system one is too old 2020-03-05 01:00:35 -04:00
Jason Rhinelander 882750b700 Don't use consumed data when recursing proxy_send
Fixes "Internal error: Invalid proxy send command; conn_pubkey or
conn_id missing"
2020-03-04 00:13:01 -04:00
Jason Rhinelander 3cb52df837 Fix conn index error
The conn_index entry wasn't being added for outgoing SN connections.
2020-03-03 23:26:14 -04:00
Jason Rhinelander 88f0a10bd8 Fix infinite loop on idle peer expiry 2020-03-03 18:12:13 -04:00
Jason Rhinelander ea5ff7790d Fix destructor when `start()` hasn't been called 2020-03-03 17:28:53 -04:00
Jason Rhinelander 2207198574 Add DESTINATION for lokimq target 2020-03-03 15:25:19 -04:00
Jason Rhinelander 428ef12506 Add missing `inline` to de-templatized hex funcs 2020-03-03 15:06:39 -04:00
Jason Rhinelander 501534b5f4 Use modern cmake thread initialization 2020-03-02 18:51:16 -04:00
Jason Rhinelander 465b398b10 Use string_view instead of taking string type by template
Fixes the case of using a char *
2020-03-02 18:50:43 -04:00
Jason Rhinelander dcb7e4df0b Add a category command helper class
This allows simplifying:

    lmq.add_category("foo", ...);
    lmq.add_command("foo", "a", ...);
    lmq.add_command("foo", "b", ...);
    lmq.add_request_command("foo", "c", ...);

to:

    lmq.add_category("foo", ...)
        .add_command("a", ...)
        .add_command("b", ...)
        .add_request_command("b", ...)
        ;
2020-03-02 15:11:54 -04:00
Jason Rhinelander a43ee15b58 _sv wasn't being defined inline 2020-03-02 15:11:29 -04:00
Jason Rhinelander b3abcfc9ae Add ""_sv literal that works just like C++17 ""sv 2020-03-02 14:24:07 -04:00
Jason Rhinelander f18f86cf96 Allow `optional` and `incoming` to take a bool
This makes it much more convenience to use them with a run-time
condition; this simplifies:

    if (should_be_optional)
        lmq.send(..., send_option::optional{});
    else
        lmq.send(...);

to:

    lmq.send(..., send_option::optional{should_be_optional});
2020-03-02 14:24:07 -04:00
Jason Rhinelander 7be9d71d7f CMake updates: exports, drop static, disable cppzmq tests
- Properly export the lokimq::lokimq target for use as a sub-project
- Drop the lokimq::static target; the library will just be static or
non-static dependending on cmake's BUILD_SHARED_LIBS setting
- Properly disable cppzmq tests (the previous setting resulted in cmake
warnings)
2020-03-02 14:24:07 -04:00
Jason Rhinelander 0493082040 Add default allow to `listen_plain()`
The default on listen_curve() was supposed to go on both.
2020-03-01 23:54:06 -04:00
Jason Rhinelander 1cf02d0c66 Fix invalid access in peer address debug message 2020-03-01 15:21:09 -04:00
Jason Rhinelander 46c9f147ec Better subproject cmake support
- disable cppzmq test building
- add target for main and static library
- don't build tests by default when used as a subproject
2020-03-01 14:28:50 -04:00
Jason Rhinelander 4059f93e8c Add note about not blocking job + minor wording fixes 2020-03-01 14:25:52 -04:00
Jason Rhinelander ddeea78b15
Merge pull request #2 from loki-project/non-sn-comms
Added support for general (non-SN) communications
2020-03-01 13:14:26 -04:00
Jason Rhinelander 077c5f4722 Update various outdated things in the readme 2020-02-29 17:49:15 -04:00
Jason Rhinelander e4f93afafa Fix trace IP address 2020-02-29 16:34:37 -04:00
Jason Rhinelander 922435ca3b Add auth and ConnectionID routing tests 2020-02-29 16:06:55 -04:00
Jason Rhinelander 1ad68b2605 Wrap HI response in try/catch
It's possible that the client has gone away, in which case we can get an
exception raised from an unroutable request.
2020-02-29 16:06:08 -04:00
Jason Rhinelander 3be632e73e Fix auth_level for remote connections
The wrong key was being set here (deserialization expects auth_level).
2020-02-29 16:04:43 -04:00
Jason Rhinelander 09c487f327 Add ability to use random routing ids for outgoing 2020-02-29 16:03:25 -04:00
Jason Rhinelander ece8870896 Move routing prefix into ConnectionID
This allows storing a ConnectionID received in a message callback and
using it later to send another message along the connection without
worrying about a routing id: the ConnectionID will have it if it is
required.  Previously you would have had to store the ConnectionID *and*
the routing prefix, and then specified the route as a
send_option::route{}, which was annoying and cumbersome.
2020-02-29 16:01:47 -04:00
Jason Rhinelander 28e36a3eaf Make AuthLevel stream printable 2020-02-29 15:16:58 -04:00