Commit graph

86 commits

Author SHA1 Message Date
Jason Rhinelander
48d3f261d3 1.0.1 release
- internal data structure change to help armhf/gcc-6
- various test suite fixes
- various build system improvements
2020-03-21 12:57:45 -03:00
Jason Rhinelander
04e2bf7cf7 Change pending_connects from vector to list
Having this as a vector seems to cause armhf/gcc-6 to segfault.  On
closer inspection there's no good reason this should be a vector in the
first place: it only gets used during new connection handshaking and
isn't in any hot loop, plus the elements are fairly large tuples where
shifting elements is going to be relatively expensive.  Thus switching
it to a list everywhere (rather than just on old gcc arm) seems fine.
2020-03-21 12:56:46 -03:00
Jason Rhinelander
98b1bd6930 Add more locks around assertions
Catch2 isn't currently thread safe, so if we hit one of these assertions
while some other thread is doing things such as logging we might
segfault.
2020-03-21 12:56:13 -03:00
Jason Rhinelander
3a120efb79 Increase test timeouts for arm
These *sometimes* spurious fail because apparently they weren't quite
long enough to pass tests on my Pi 4.
2020-03-21 11:10:07 -03:00
Jason Rhinelander
0a7074c573 Add BUILD_BYPRODUCTS so that ninja build works 2020-03-19 19:54:24 -03:00
Jason Rhinelander
a36e53d409 More linking overhaul
- Don't try to use cppzmq, just find libzmq ourselves.
- Allow existing `libzmq` and `sodium` targets to be used to control how
we link to libzmq and/or sodium.
- Use PkgConfig:: targets instead of the older bunch-of-variables
approach (requires cmake >= 3.6).
2020-03-15 01:43:23 -03:00
Jason Rhinelander
bc0e6be801 Add sodium dep if embedding static lib when doing a shared build, too 2020-03-14 16:06:58 -03:00
Jason Rhinelander
dd088c8ba5 cmake compatibility fix 2020-03-14 15:17:48 -03:00
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