Wykres commitów

560 Commity (pre-commit)

Autor SHA1 Wiadomość Data
Marius Kriegerowski 65fe9bedc1 inherit BrokerException from Exception 2021-03-26 15:20:24 +01:00
Marius Kriegerowski d50eef989a Fix mutable in signature 2021-03-21 16:46:41 +01:00
Marius Kriegerowski 613e77f6b4 more strict flake8. Fixed typos. 2021-03-17 10:57:32 +01:00
Florian Ludwig b72a389e6c use brokwer_uri default in client connection 2021-03-16 10:59:26 +01:00
Florian Ludwig 560eed263b cleanup BrokerContext.sessions 2021-03-16 10:59:26 +01:00
Florian Ludwig f328f8ca90 add more type hints 2021-03-16 10:59:26 +01:00
Florian Ludwig f3d7fa90f3 cleanup broker.start 2021-03-16 10:59:26 +01:00
Florian Ludwig 9f35a20b78 replace not_in_dict_or_none with more pythonic check 2021-03-16 10:59:26 +01:00
Florian Ludwig 14b54d830f cleanup utils.gen_client_id 2021-03-16 10:59:26 +01:00
Florian Ludwig 9069f9bc14 fix return type of decode_string 2021-03-16 10:59:26 +01:00
lrasku c41b01499d Fix topic filter matching
- re.escape() the whole filter string first to escape _all_ regex
  metacharacters in it, not just $. (# and + are both regex metacharacters,
  so their replace expressions now need a leading \\ to replace the
  escaping, too.)
- # matches topics both with and without a trailing /, so the replace
  expressions adds a '?' before the '.*'. The .lstrip('?') at the end removes
  this in case the # was the first character in the filter.
- + should only match a single level, but it should _also_ match empty levels,
  so use '[^/]*' to replace it.
- Use Regex.fullmatch() to match against the whole topic string, not just
  its start.

Also add two unit tests to test this matching, and fix an incorrect match
against + in test_client_subscribe_publish_dollar_topic_2.
2021-03-15 13:43:47 +01:00
Marius Kriegerowski 7921e2cc22 linter project with black at default line length 88 2021-03-15 10:18:00 +01:00
lrasku 8e8aafd33e Make WebSockets work with IPv6 addresses
WebSocketsWriter.get_peer_info() naively returns just
self._protocol.remote_address, but this is a 4-tuple in IPv6,
which will raise ValueErrors when client code tries to unpack
it into two elements. Fortunately the first two elements of the
tuple are the same as in IPv4 and should be all that we need
(get_peer_info() is currently only used for logging), so just
return a 2-prefix of the value instead.
2021-03-15 10:16:50 +01:00
Marius Kriegerowski db3dffa857 use black linter with 96 char line length 2021-03-14 21:44:41 +01:00
lrasku 295418a11f Permit connect() and reconnect() coroutines to be cancelled
The plain `except BaseException` statement used in the two coroutines
also matches asyncio.CancelledError and thus prevents them from
being cancelled. Prepend a simple re-raising except block for
asyncio.CancelledError to get them to work with task cancellation.
2021-03-14 16:55:29 +01:00
Florian Ludwig 87d19c5342 prepare second alpha release: 0.10.0-alpha.1 2021-03-13 18:28:01 +01:00
Florian Ludwig 6f47441fdd cleanup versioning system 2021-03-13 17:02:50 +01:00
Florian Ludwig 836fa0e049 prepare 0.10.0 release 2021-03-13 17:02:50 +01:00
Stein Magnus Jodal b85774439e Move scripts module into hbmqtt module
Fixes #166
2021-03-13 15:58:25 +01:00
Florian Ludwig 4a9594e6f3 fix TopicTabooPlugin for anonymous users
Thanks to https://github.com/JNevrly
See also https://github.com/beerfactory/hbmqtt/pull/151
2021-03-10 10:20:22 +01:00
Girts Folkmanis 7cd230e6b2 Pass in loop to PluginManager
If `loop` is passed to `MQTTClient`, previously it was not passed down
to `PluginManager`, which could potentially grab a different loop from
`asyncio.get_event_loop()`, resulting in a separate event loop being
created or wrong one being used. Now the `loop` argument is passed down
as expected.
2021-03-10 10:09:10 +01:00
Marius Kriegerowski 30582f4cac Revert "Fixed critical bugs e.g., incorrectly retained messages on qos0, race conditions on detached sessions, eliminated set_exception on client disconnect tasks, a few debug log message isEnabledFor wrappers."
This reverts commit 1f5efd383f.
2021-03-09 19:13:32 +01:00
Marius Kriegerowski 7b7d17b789 fix async lock call 2021-03-09 19:13:32 +01:00
Marius Kriegerowski 6f586c253c Fix missing plugin property 2021-03-09 19:13:32 +01:00
Marius Kriegerowski e0fabc0bc3 Refactor to comply python3.8 2021-03-09 19:13:32 +01:00
Nicolas 07c4c70f06
Merge pull request #213 from shipmints/misc-fixes
Misc fixes
2020-04-10 20:47:06 +04:00
shipmints 304c731831 Another asyncio fix to properly handle CancelledError as normal (and reraise) vs. exception 2020-04-02 11:34:46 -04:00
shipmints 1f5efd383f Fixed critical bugs e.g., incorrectly retained messages on qos0, race conditions on detached sessions, eliminated set_exception on client disconnect tasks, a few debug log message isEnabledFor wrappers. 2020-04-01 15:09:09 -04:00
shipmints 31165fb0e8 asyncio correctness and race-condition tweaks 2020-02-22 07:30:34 -05:00
shipmints 6d6dd997f1 Asyncio fixes 2020-02-20 10:46:29 -05:00
shipmints 69e3e0bc5b Slight enhancement to client_tasks.pop() in cancel tasks and disconnect logic. 2020-02-17 14:56:59 -05:00
Nicolas 4f5f19aac3
Merge pull request #204 from shipmints/fix-mem-leaks
Corrected memory leak of task refs in client deliver_message on timeo…
2020-02-17 20:43:00 +04:00
shipmints 138313a3eb Corrected memory leak of task refs in client deliver_message on timeout causing client_tasks to grow forever, in plugin/manager causing _fired_events to grow forever 2020-02-14 20:36:17 -05:00
Nicolas f76be85a0a
prepare next version 2020-01-25 18:14:20 +04:00
Nicolas f81de68aed
release 2020-01-25 18:08:07 +04:00
Anton Lindroth b0505ff093 Getting peer address with self._protocol.remote_address in WebSocketsWriter.get_peer_info 2019-11-28 07:30:27 +01:00
Jan Seeger d8450e9922 Enable reuse_address by default. 2019-08-06 17:06:22 +02:00
Nicolas 4d44a056fa
Merge pull request #186 from agebhar1/feature/PyYAML5
fix PyYAML warning on call of `yaml.load(…)`
2019-07-28 12:29:12 +02:00
Andreas Gebhardt f8751ca94b fix PyYAML warning on call of `yaml.load(…)`
Since PyYAML v5.1 a warning on deprecation is printed:

> YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated,
> as the default Loader is unsafe. Please read https://msg.pyyaml.org/load
> for full details.

Use the `FullLoader`s suggared variant `yaml.full_load` according to the
documentation [1] if it's present. Then it's assumed that PyYAML >= v5.1 is
used.

[1] https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation#how-to-disable-the-warning
2019-06-30 20:03:49 +02:00
andvikt 8a20cbe0c7
Update client.py
python 34 support
2019-06-04 10:17:17 +03:00
Andrey Viktorov 99d76012ea Added cancel pending tasks coro 2019-06-03 22:42:19 +03:00
Richard Kojedzinszky a6c8810d5b hbmqtt.client: fix a Task leak
We should cleanup all pending events.
2019-03-18 19:19:05 +01:00
Nicolas 1608573af6
Merge pull request #154 from burnpanck/bugfix/await-asyncio.wait-in-mqtt-connected
do actually wait for the connection in the mqtt_connection decorator
2019-03-11 12:10:17 +01:00
Nicolas 4ddfd466ba
Merge pull request #169 from d21d3q/feature/infinite_reconnect
Add option for infitie reconnecting.
2019-03-07 16:13:05 +01:00
Zdzislaw Krajewski 6f282187d8 Add protocol write synchronization.
Concurrent write to protocol was causing library to crash when
drain() function was called simltaneously.
2019-03-05 10:07:05 +01:00
Zdzislaw Krajewski e9db78a3b0 Add option for infitie reconnecting.
It simplifies reconnection logic. In case of long running services which publish data to server,
there is need to reconnect anyway. When reconnect_retries elapses, then reconnection have to be
done manually. Carrying about it inside coroutine which publishing data introduces complexity.
2019-02-25 14:55:51 +01:00
Bharath Yadavally e140ec045a Added missing ack_timeout param expected in mqtt_publish method of handler.py 2019-01-08 15:28:03 +11:00
Román Cárdenas 9d81b1f4a9 ACL plugin and documentation 2019-01-04 18:29:48 +01:00
Schneider 0ceadbff86 replaced tabs with spaces 2018-12-05 15:55:30 +01:00
Schneider 7cc5e17988 improved documentation and script integration of extra_headers 2018-12-05 15:39:31 +01:00