Commit Graph

351 Commits

Author SHA1 Message Date
Jason Rhinelander ac6ef82ff6
Merge branch 'dev' into stable 2022-10-05 20:27:29 -03:00
Jason Rhinelander ff0e515c51
Fix installed headers
- Remove more deprecated shim headers
- Remove the gone (and newly gone) headers from the install list
- Add missing pubsub.h to install list
2022-10-05 20:26:34 -03:00
Jason Rhinelander ae57e27c4b
Merge remote-tracking branch 'origin/dev' into stable 2022-10-05 19:40:25 -03:00
Jason Rhinelander 2e308d4f43
Merge pull request #82 from oxen-io/fix-race-condition
Attempt to fix a race condition
2022-10-05 19:35:28 -03:00
Jason Rhinelander 445f214840
Fix a race condition with tagged thread startup
There's a very rare race condition where a tagged thread doesn't seem to
exist when the proxy tries syncing startup with them, and so the proxy
thread hangs in startup.

This addresses it by avoiding looking at the `proxy_thread` variable
(which probably isn't thread safe) in the worker's startup, and
signalling the you-need-to-shutdown condition via a third option for the
(formerly boolean) `tagged_go`.
2022-10-05 19:32:54 -03:00
Jason Rhinelander 358005df06
Merge pull request #80 from tewinget/pubsub
initial implementation of generic pub/sub management
2022-09-28 16:48:13 -03:00
Thomas Winget 85437d167b initial implementation of generic pub/sub management
Implements a generic pub/sub system for RPC endpoints to allow clients
to subscribe to things.

patch version bump

tests included and passing
2022-09-28 15:43:45 -04:00
Jason Rhinelander b26fe8cb04
Merge pull request #81 from jagerman/remove-deprecated
Remove deprecated code
2022-09-28 14:47:49 -03:00
Jason Rhinelander df19d1dd94
Add sid workaround
lsb_release -sc on sid currently prints 'n/a' because of debian bugs
1020893 and 1008735.  Add a workaround.

Also bumps clang builds to latest version.
2022-09-28 14:00:05 -03:00
Jason Rhinelander 25f714371b
Remove deprecated code
- Removes the old lokimq name compatibility shims
- Removes the oxenmq::bt* -> oxenc::bt* shim headers
2022-09-28 13:28:48 -03:00
Jason Rhinelander 0858dd278b
oxen-encoding submodule to latest tagged release 2022-08-31 12:00:07 -03:00
Jason Rhinelander a93c16af04
oxen-encoding submodule to latest tagged release 2022-08-31 11:59:24 -03:00
Jason Rhinelander aea9b98b0c
Merge remote-tracking branch 'origin/dev' into stable 2022-08-31 11:57:34 -03:00
Jason Rhinelander 057685b7c0
Merge pull request #79 from jagerman/socket-limits
Fix zmq socket limit setting
2022-08-31 11:57:22 -03:00
Jason Rhinelander 3a3ffa7d23
Increase ulimit on macos
The test suite is now running out of file descriptors, because of
macos's default tiny limit.
2022-08-31 11:49:44 -03:00
Jason Rhinelander edcde9246a
Fix zmq socket limit setting
MAX_SOCKETS wasn't working properly because ZMQ uses it when the context
is initialized, which happens when the first socket is constructed on
that context.

For OxenMQ, we had several sockets constructed on the context during
OxenMQ construction, which meant the context_t was being initialized
during OxenMQ construction, rather than during start(), and so setting
MAX_SOCKETS would have no effect and you'd always get the default.

This fixes it by making all the member variable zmq::socket_t's
default-constructed, then replacing them with proper zmq::socket_t's
during startup() so that we also defer zmq::context_t initialization to
the right place.

A second issue found during testing (also fixed here) is that the socket
worker threads use to communicate to the proxy could fail if the worker
socket creation would violate the zmq max sockets limit, which wound up
throwing an uncaught exception and aborting.  This pre-initializes (but
doesn't connect) all potential worker threads sockets during start() so
that the lazily-initialized worker thread will have one already set up
rather than having to create a new one (which could fail).
2022-08-05 10:40:01 -03:00
Sean c854046684
Merge pull request #78 from darcys22/custom-formatters
Adds custom formatters for ConnectionID and AuthLevel
2022-08-04 11:03:01 +10:00
Sean Darcy c91e56cf2d adds custom formatter for OMQ structs that have to_string member 2022-08-04 10:50:02 +10:00
Jason Rhinelander 61b7505304
Update oxenc so that oxenc::oxenc target exists 2022-06-09 13:26:58 -03:00
Jason Rhinelander eadb37c765
Merge remote-tracking branch 'origin/dev' into stable 2022-05-30 13:29:44 -03:00
Jason Rhinelander b0c3bd4ee9
fix linkage for submodule dep use 2022-05-30 13:28:52 -03:00
Jason Rhinelander 53443bbc31
Merge remote-tracking branch 'origin/dev' into stable 2022-05-30 13:13:52 -03:00
Jason Rhinelander fd95919704
Merge pull request #77 from jagerman/private-linking
Fix use of parent oxenc::oxenc target
2022-05-30 13:13:17 -03:00
Jason Rhinelander 4671af3ca0
Fix use of parent oxenc::oxenc target
oxen-mq's export command errored when using a parent oxenc target in a
submodule oxen-mq; add an intermediate IMPORTED target so that cmake
knows it doesn't have to export the oxenc dependency as well.
2022-05-30 13:07:49 -03:00
Jason Rhinelander 930a56d6bb
Merge remote-tracking branch 'origin/dev' into stable 2022-05-30 10:52:04 -03:00
Jason Rhinelander c4b7aa9b23
Merge pull request #76 from jagerman/optimizations
Optimizations
2022-05-30 10:51:40 -03:00
Jason Rhinelander 115c5550ca
Bump version & embedded oxenc version 2022-05-24 16:15:39 -03:00
Jason Rhinelander ace6ea9d8e
Avoid unnecessary nullptr assignment
We can just leave the dangling pointer value in the `run` object: even
though we just deleted it, there's no need to reset this value because
it will never be used again.  (And even if we did, we don't check
against nullptr anyway so having a nullptr here doesn't make anything
safter than a dangling pointer).

The assignment (into the variant) uses a small amount of CPU (via
std::variant), so better for performance to just leave it dangling.
2022-05-12 12:48:46 -03:00
Jason Rhinelander 62a803f371
Add missing header
This was surely coming in implicitly already, but better to be explicit.
2022-05-12 12:48:15 -03:00
Jason Rhinelander d86ecb3a70
Use fixed vector for idle workers
Use a count + fixed size vector with a separate variable tracking the
size seems to perform slightly better than popping/pushing the vector.
2022-05-12 12:44:54 -03:00
Jason Rhinelander 45791d3a19
Use fixed array for known-small internal messages
Internal messages (control messages, worker messages) are always 3 parts
or less, so we can optimize by using a stack allocated std::array for
those cases rather than needing to continually clear and expand a heap
allocated vector.
2022-05-12 12:42:08 -03:00
Jason Rhinelander b8e4eb148f
Use raw index bytes in worker router
Change the internal worker routing id to be "w" followed by the raw
integer bytes, so that we can just memcpy them into a uint32_t rather
than needing to do str -> integer conversion on each received worker
message.

(This also eliminates a vestigal call into oxenc internals).
2022-05-12 12:38:13 -03:00
Jason Rhinelander fa6de369b2
Change std::queue to std::deque typedef
This shouldn't make any difference with an optimizing compiler, but
makes it easier a bit easier to experiment with different data structures.
2022-05-12 12:32:17 -03:00
Jason Rhinelander 371606cde0
Eliminate useless unordered_set
I don't know what this set was originally meant to be doing, but it
currently does nothing (except adding overhead).

The comment says it "owns" the instances but that isn't really true; the
instances effectively already manage themselves as they pass the pointer
through the communications between proxy and workers.
2022-05-12 12:25:46 -03:00
Jason Rhinelander 3a51713396
Add simpler Job subclass of Batch for simple jobs
This adds a much simpler `Job` implementation of `Batch` that is used
for simple no-return, no-completion jobs (as are initiated via
`omq.job(...)`).

This reduces the overhead involved in constructing/destroying the Batch
instance for these common jobs.
2022-05-12 12:20:51 -03:00
Jason Rhinelander 5c7f6504d2
Fix cmake compilation properties
For some reason using target_compile_features doesn't properly set up
C++17 flags in the generate compile_commands.json, which then breaks
clang-complete.  Switch to use properties instead, which works.
2022-05-12 12:15:30 -03:00
Jason Rhinelander 5a3c12e721
Merge pull request #74 from XutaxKamay/patch-1
Fix libzmq library linking
2022-04-07 11:15:24 -03:00
xutaxkamay f0c2222d6e Fix libzmq library linking
Fixes prefix for libzmq library output path
2022-04-07 07:14:23 +02:00
Jason Rhinelander 320a85ac0c
Merge pull request #73 from jagerman/cmake-pkgconfig-workaround
Cmake pkgconfig workaround
2022-03-30 16:56:20 -03:00
Jason Rhinelander 7fca36b3a9
Use liboxenc-dev in ci jobs 2022-03-30 16:21:03 -03:00
Jason Rhinelander bbdf4af98f
cmake work-around for cmake < 3.21
PkgConfig::xyz won't exist before 3.21 if xyz doesn't require any flags
(which is common for a system-installed header-only library like oxenc).

(CMake bug 22180)
2022-03-30 16:09:40 -03:00
Jason Rhinelander 5c72a57eca
Merge remote-tracking branch 'origin/dev' into stable 2022-02-10 14:01:54 -04:00
Jason Rhinelander 77c4840273
Fix extra file in header install list 2022-02-07 14:41:51 -04:00
Jason Rhinelander d7f5efebc1
Merge pull request #72 from jagerman/oxenc
Use oxen-encoding and add compatibility shim headers
2022-02-07 14:39:59 -04:00
Jason Rhinelander a0a54ed461
Fix static build 2022-02-07 14:38:19 -04:00
Jason Rhinelander 045df9cb9b
Use oxen-encoding and add compatibility shim headers
bt_*, hex, base32z, base64 all moved to oxen-encoding a while ago; this
finishes the move by removing them from oxenmq and instead making oxenmq
depend on oxen-encoding.
2022-01-18 10:30:23 -04:00
Jason Rhinelander 816fd31bf7
Merge remote-tracking branch 'origin/dev' into stable 2021-12-02 19:10:37 -04:00
Jason Rhinelander 3d178ce3ea
Merge pull request #71 from jagerman/disable-ipv6
Disable IPv6 by default
2021-12-02 19:06:50 -04:00
Jason Rhinelander fe8a1f4306
Disable IPv6 by default
libzmq's IPv6 support is buggy when also using DNS hostname: in
particular, if you try to connect to a DNS name that has an IPv6
address, then zmq will *only* try an IPv6 connection, even if the local
client has no IPv6 connectivity, and even if the remote is only
listening on its IPv4 address.

This is much too unreliable to enable by default.
2021-12-02 19:01:21 -04:00
Jason Rhinelander dd566b99dc Merge remote-tracking branch 'origin/dev' into stable 2021-11-30 14:30:19 -04:00