Commit Graph

110 Commits

Author SHA1 Message Date
Jason Rhinelander 227060fc6f
1.0.5 release 2023-09-27 20:17:31 -03:00
Jason Rhinelander 8ddb916997
Fix python binding segfault
This fixes a segfault in the reply handling code, where the destructor
of a `py::function` wasn't necessarily happening with the GIL held,
which could make Python segfault.

The solution that was here to address this didn't work because it was
relying on std::optionals, but it is possible (and apparently sometimes
happens) that the std::function this lambda gets stuffed into gets moved
(or maybe copied?), which then results in *two* lambda destructions: we
were correctly dealing with the one that eventually gets called by
clearing things properly when it gets called, but the temporary
destructor also fires, and that is the one that broke.

This changes it to instead leak bare pointers into the lambda and then
recapture them inside when we get called; since we are guaranteed to be
called exactly once, this recaptures them without losing them but
doesn't incur destruction of a py::function deep in oxenmq (outside of
GIL scope).
2023-09-27 20:17:06 -03:00
Jason Rhinelander b79013b7ea 1.0.4 2023-03-28 09:36:43 +11:00
Jason Rhinelander 5944b82e3d Merge remote-tracking branch 'origin/stable' into debian/bullseye 2023-03-28 09:36:41 +11:00
Jason Rhinelander 38ba790d8b Merge branch 'dev' into stable 2023-03-28 09:33:33 +11:00
Jason Rhinelander 5359810a10
Merge pull request #12 from jagerman/connect-auth-level
Expose setting auth level on outgoing connection
2023-03-28 09:30:41 +11:00
Jason Rhinelander ace70998d7 fix debian sid builds
Python 3.11+ complains when trying to use pip globally, but for CI it
seems fine to override (and potentially break the temporary CI image).
2023-03-28 09:21:15 +11:00
Jason Rhinelander 6e50822bc9
Expose setting auth level on outgoing connection
This is necessary to allow a remote to issue authenticated commands back
to us.
2023-03-08 17:31:49 -04:00
Jason Rhinelander 25d87e7f33
1.0.3 2022-12-02 17:44:18 -04:00
Jason Rhinelander 42365049fa
Merge remote-tracking branch 'origin/stable' into debian/bullseye 2022-12-02 17:44:14 -04:00
Jason Rhinelander 477e417d3e
Merge remote-tracking branch 'origin/dev' into stable 2022-12-02 17:40:03 -04:00
Jason Rhinelander 30a9a26ea7
Merge pull request #11 from jagerman/remove-bencode
Remove base32z encoding
2022-08-04 14:28:54 -03:00
Jason Rhinelander f62fa4916f
Remove base32z encoding
We have pyoxenc for that instead.
2022-08-04 13:31:22 -03:00
Jason Rhinelander 4bf412905a
Rename is_reply -> is_request
The property is retrieving whether a reply is expected, not whether the
message itself is a reply.
2022-06-09 18:29:29 -03:00
Jason Rhinelander 296f61a7c0
macos compilation fix
macos clang won't apply the implicit `operator std::string()` from
py::bytes here for some unknown reason.
2022-01-11 11:16:47 -04:00
Jason Rhinelander df9b8be79e
1.0.2 with misc fixes (see PR #10) 2021-12-03 15:41:42 -04:00
Jason Rhinelander b8ed189de7
Merge remote-tracking branch 'origin/stable' into debian/bullseye 2021-12-03 15:41:41 -04:00
Jason Rhinelander b5f3ff6132
Merge remote-tracking branch 'origin/dev' into stable 2021-12-03 15:40:12 -04:00
Jason Rhinelander e4b9a39fd0
Merge pull request #10 from jagerman/fixes
Fixes
2021-12-03 15:39:55 -04:00
Jason Rhinelander 36e32066d0
Version bump 2021-12-03 13:10:19 -04:00
Jason Rhinelander 4136c29d06
Make Message property accessors copy
The default references, which breaks because Message gets reused, so
storing `.conn` gives you something that changes the next time a worker
gets a message.
2021-12-03 13:08:11 -04:00
Jason Rhinelander f1160d0a25
Make allow_connection properly optional 2021-12-03 13:07:49 -04:00
Jason Rhinelander 4020ab8a49
Make ConnectionIDs hashable 2021-12-03 13:07:35 -04:00
Jason Rhinelander 0529f14bcb
rebuild against newer oxenmq 2021-12-02 19:18:16 -04:00
Jason Rhinelander 4a25530219
fix allow callback 2021-12-02 15:41:38 -04:00
Jason Rhinelander 3f642ede89
Merge remote-tracking branch 'origin/stable' into debian/bullseye 2021-12-02 15:41:29 -04:00
Jason Rhinelander 8010b5984e
Merge remote-tracking branch 'origin/dev' into stable 2021-12-02 15:40:17 -04:00
Jason Rhinelander a678fcf0ce
Remove include for older pybind compatibility 2021-12-02 15:39:54 -04:00
Jason Rhinelander ca7a068140
fix allow callback 2021-12-02 15:21:01 -04:00
Jason Rhinelander a85dade6ec
Merge remote-tracking branch 'origin/stable' into debian/bullseye 2021-12-02 15:20:59 -04:00
Jason Rhinelander 041d2051df
Merge branch 'dev' into stable 2021-12-02 15:20:08 -04:00
Jason Rhinelander 59e86ab6b6
Merge pull request #9 from jagerman/fix-allow-func
Fix allow function argument decoding error
2021-12-02 15:17:04 -04:00
Jason Rhinelander 530280ac60
Fix allow function argument decoding error
Avoids a utf-8 decoding error when accepting a connection with an allow
function by properly wrapping the function in a version that passes
pubkey as a `bytes`.
2021-12-02 15:14:54 -04:00
Jason Rhinelander 83242e92dd rebuild against newer oxenmq 2021-11-30 15:24:10 -04:00
Jason Rhinelander 43088dc3ca use prebuilt builder ci; reformat 2021-10-27 12:19:40 -03:00
Jason Rhinelander 766f829501 1.0.0 final release 2021-10-22 20:26:17 -03:00
Jason Rhinelander 139db1e938 Merge remote-tracking branch 'origin/stable' into debian/bullseye 2021-10-22 20:26:05 -03:00
Jason Rhinelander 37b35000d3
Merge pull request #8 from oxen-io/dev
1.0.0
2021-10-22 20:24:33 -03:00
Jason Rhinelander 367007dd66 Update readme for new code 2021-10-22 20:22:54 -03:00
Jason Rhinelander 63f9e915f7 1.0.0 final release 2021-10-22 20:15:34 -03:00
Jason Rhinelander 4a163639a6 Merge remote-tracking branch 'origin/dev' into debian/bullseye 2021-10-22 20:15:30 -03:00
Jason Rhinelander 06e0e2eb44
Merge pull request #7 from jagerman/redo
pyoxenmq overhaul
2021-10-22 20:09:09 -03:00
Jason Rhinelander b12c754895 Fixes and address warnings
- timeout in the syncronous connect_remote wasn't being passed through
- callback and syncronous connect_remote had some deviation in args;
  unified them to both take keyword-only timeout and
  ephemeral_routing_id, and to take timeout as a timedelta with a
  default (rather than an optional in the callback-based one).
- removed unused "noopt".  I forget what it was for, but it didn't end
  up being used.
2021-10-22 19:12:57 -03:00
Jason Rhinelander 6d59248f45 Build with -Wextra -Werror and color 2021-10-22 19:12:57 -03:00
Jason Rhinelander 97238b04ba Hacking around for macos
Build local oxenmq

Install everything into a local prefix
2021-10-22 19:12:57 -03:00
Jason Rhinelander 996370228c Add drone build & tests 2021-10-22 19:12:57 -03:00
Jason Rhinelander 171e94cf11 Add simple pytest tests 2021-10-22 17:03:06 -03:00
Jason Rhinelander 5ceed8a416 Various fixes for bugs revealed in testing
- make extract data parts always flatten to arbitrary depth.  We were
  only flattening once (and only sometimes), but arbitrary flattening is
  nicer (as long as we don't ultimately encouter anything that isn't
  str/bytes).
- fix Message.data()/.dataview() pre-loading nulls into the list.  The
  py::list constructor argument here is pre-fill, not a reservation.
- fix add_command: it was broken because when the wrapped callback gets
  invoked it tries casting the Message via copying, but that breaks
  (Message isn't copyable).  Fix it by adding a wrapper that does a
  referencing cast to a Python object.
- Add missing docs for add_command
- Doc typo fixes
- Remove OxenMQ default and loglevel constructors, and make the
  remaining constructor take everything by keyword arguments.  (Default
  constructor remains equivalent, and the log-level constructor now has
  to have the log level named).
- Fix OxenMQ keyword constructor: invoking it was failing because the
  annotation default on sn_lookup wasn't properly castable to the
  required types (it should be py::none() rather than nullptr).  Also
  fix the defaults for pubkey/privkey to be py::bytes() (the empty
  string worked fine, but using bytes makes it show up as bytes defaults
  in the generated signature doc string).
- Further document connect_inproc with a description of why you might
  want it.
- Fix send not actually including the message data parts
- Work around segfault in the reply callback: because we have lambdas
  with python object captures, we'd segfault in the proxy thread when it
  frees them after calling them because that freeing invokes python
  destructor but it doesn't hold the gil.  Fixed by making the lambda
  consume its own callbacks (which is fine because oxenmq will invoke
  the callback exactly once).
- Fix request_future invocation which raised an error on invocation:
  straight lambdas aren't castable to python objects, so stuff the
  lambda inside std::functions, which are.
2021-10-22 16:28:21 -03:00
Jason Rhinelander 6a382865b2 Remove cmake build system and submodules
setup.py works fine, and we don't need two separate build systems.

Remove the submodules as well because we aren't using them and don't
need them; you should install pybind11 and oxenmq outside this project.
2021-10-22 16:09:36 -03:00
Jason Rhinelander a62f6c4769 Formatting 2021-10-22 16:08:57 -03:00