Commit Graph

78 Commits

Author SHA1 Message Date
Korina Šimičević
40b1f7e00c Initiation lambdas replaced with classes with executor_type/get_executor
Summary:
related to #13, T13767
`asio::cancel_at` and `asio::cancel_after` (coming with Boost 1.86) use associated executor
from the initiation object to construct the underlying timer.

Therefore, initiation lambdas are replaced with classes with executor_type/get_executor to allow that functionality
(like Asio/Beast).

Alternative solutions:
 1) asio::bind_executor(get_executor(), initiation)
 2) async_compose

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D30861
2024-08-09 09:01:45 +02:00
Korina Šimičević
0330df77a3 Add missing assignment operators
Summary:
related to T13767
- add missing assignment operators
- marked single argument constructors as explicit where needed
- add even more missing includes

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D30813
2024-08-08 10:59:38 +02:00
Korina Šimičević
b55ec679bf Add support for immediate executors
Summary: related to T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D30809
2024-08-08 08:08:34 +02:00
Korina Šimičević
7bc1ccf072 Add support for default completion tokens
Summary: related to #12 T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D30725
2024-08-06 08:22:16 +02:00
Korina Šimičević
d52090f438 Add support for g++-13,14
Summary:
related to T13767, #9

fix compilation error on g++-14
add g++-13 & g++-14 workflow to CI (requires ubuntu 24.04)

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D29794
2024-06-03 09:57:24 +02:00
Korina Šimičević
927c1c6e3a Update license to BSL-1.0
Summary: related to T13767 T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D29686
2024-05-27 10:59:59 +02:00
Korina Šimičević
68840dda95 Add missing topic alias name validation
Summary:
related to T13767

- allow empty topic name + topic alias in props
- add mqtt features tests

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D29445
2024-05-15 07:43:44 +02:00
Korina Šimičević
b2338d4135 async_run's associated ex will not replace mqtt_client's default ex
Summary: related to T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D29383
2024-05-13 08:56:20 +02:00
Korina Šimičević
794f48e915 Add support for g++-9 compiler
Summary: related to #7, T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D29302
2024-05-09 14:55:04 +02:00
Korina Šimičević
bfae05f7a9 Remove deprecated API usage
Summary: related to T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28958
2024-04-16 11:54:46 +02:00
Bruno Iljazovic
174b0c312f Maintain publish order even when throttling.
Summary: When broker sets receive maximum, and multiple messages with QoS 0 and QoS > 0 are published at the same time, we should maintain order in which async_publish calls were made. Before, QoS > 0 publishes would always be put at the end of the buffer.

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D28456
2024-03-22 10:45:18 +01:00
Korina Šimičević
a1249b433d Reconnect on every Reason Code > 0x80 received in the CONNACK packet
Summary: related to T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28217
2024-02-29 14:18:33 +01:00
Bruno Iljazovic
701698e5ec resend terminal disconnect
Summary:
- if we are in the process of connecting when user invokes async_disconnect we should send a disconnect packet after connect completes
- move integration disconnect tests to integration folder

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D28119
2024-02-23 14:40:00 +01:00
Korina Šimičević
3d80f47010 Open and set socket options on the lowest layer before initiating connect_op
Summary: related to T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28111
2024-02-23 13:25:59 +01:00
Korina Šimičević
20f7f2fd5d Add Windows specific error codes to should-reconnect condition
Summary: related to T11798

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28103
2024-02-23 10:55:29 +01:00
Korina Šimičević
634a4bdfa9 async_disconnect will close the connection regardless of the current connection state
Summary: related to T13761

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28057
2024-02-22 12:14:24 +01:00
Korina Šimičević
1c29b86030 Use basic_channel instead of basic_concurrent_channel
Summary: related to T11798

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28061
2024-02-22 10:03:35 +01:00
Korina Šimičević
7cbd7725fc Wait exponentially longer when all hosts have been exhausted during reconnect
Summary: related to T13746

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27995
2024-02-19 13:26:12 +01:00
Bruno Iljazovic
c9a7184459 Use properties by reference when validating them.
Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D27963
2024-02-16 13:49:52 +01:00
Bruno Iljazovic
1acdd99f28 Support multiple subscription identifiers in received messages.
Summary:
- refactor property encoding
- change user property type to be std::pair<std::string, std::string>

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D27867
2024-02-16 10:59:07 +01:00
Korina Šimičević
eb510ae1d4 Fixed inconsistencies in connect/connack property accessor function signatures
Summary: related to T11798

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27941
2024-02-15 13:26:45 +01:00
Korina Šimičević
9cb54f73a4 Remove unnecessary casts to unsigned types
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27927
2024-02-15 12:00:42 +01:00
Bruno Iljazovic
cbe477a701 Correct two/four byte integer properties' types.
Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D27901
2024-02-14 15:20:45 +01:00
Korina Šimičević
cfa2b76176 Remove unused cnf parameter in client_service
Summary: related to T13709

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27895
2024-02-14 14:40:41 +01:00
Korina Šimičević
2b686dd6cb Add intermediate is_cancelled checks in connect_op
Summary: related to T13706

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27918
2024-02-14 14:30:40 +01:00
Korina Šimičević
e5de307723 Remove unnecessary get_cancellation_slot().clear() calls
Summary: related to T13706

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27894
2024-02-14 07:57:08 +01:00
Korina Šimičević
19aaba3cdc Re-create client_service after stopping client's runloop and let it destroy asynchronously
Summary: related to T11798, #5

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27882
2024-02-13 12:31:26 +01:00
Korina Šimičević
10aabbb483 Do not unlock the connection mutex if the operation was cancelled
Summary: related to T11798

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D27877
2024-02-13 07:38:25 +01:00
Korina Šimičević
eaac06fa6a Buildable with Boost 1.84
Summary: related to T13686, #5

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27869
2024-02-12 15:20:27 +01:00
Korina Šimičević
d1d50d029d Add connection error codes
Summary:
related to T13651
- separate code related to reason codes into their own header
- introduce new connection error codes that will be return when a non-recoverable error occurs in connect_op
- add appropriate coverage tests

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27808
2024-02-08 12:27:22 +01:00
Korina Šimičević
e0ae572e1b Cancellation fixes
Summary:
related to T11798
- Cancel functions post outstanding handlers
- Properly cancel autoconnect stream

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27763
2024-02-06 15:27:39 +01:00
Korina Šimičević
0affdb76f4 Sanity tests related to number of packets, packet size & packet priority
Summary:
related to T12015
- add tests related to sending/receiving really big packets
- add tests related to receiving multiple packets at once
- send_big_publish fails in the testing environment, but it works fine in real life

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27652
2024-02-01 10:36:18 +01:00
Korina Šimičević
33c8eea890 Add function to set keep alive/ping interval
Summary:
related to T13566
- mqtt_client has a new keep_alive(seconds) function
- keep_alive(0) disables ping
- if keep_alive() is not called, the client assumes keep_alive=10
- the client respects server_keep_alive if sent by the broker

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27557
2024-02-01 08:29:22 +01:00
Korina Šimičević
d6c4884d53 (Un)subscribe validates the number of topics and reason codes
Test Plan:
related to T12015
- (un)subscribe reason codes will always contain as many reason codes as there are topic filters
- if, by some odd chance, the client receives the wrong number of rcs or some are invalid, it will treat it as malformed
- both subscribe_op and unsubscribe_op should be 100% covered by tests now

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27592
2024-01-30 15:25:58 +01:00
Korina Šimičević
4bf59cc18c Better test packet logging & validation
Summary:
related to T12015, T11798
- improved packet logging in test broker for easier debugging
- test broker will fail the test if a packet is sent after all the messages were exchanged
- fixed a bug in assemble_op where read buffer was not properly cleared if an error occurred (for example, malformed packet cases)

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D27561
2024-01-26 10:28:41 +01:00
Korina Šimičević
61f17f6e0f Fix user property encoding
Summary: related to T11798

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27532
2024-01-24 13:03:38 +01:00
Korina Šimičević
85ef3e70e4 Simplify and shorten unit test code - part 2
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27502
2024-01-23 08:50:26 +01:00
Korina Šimičević
fa014fc337 Add op cancellation tests
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27459
2024-01-19 14:47:14 +01:00
Korina Šimičević
d7d0b4c239 Add re authentication tests
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27436
2024-01-19 11:30:41 +01:00
Korina Šimičević
6267c5f706 Connect_op basic unit tests
Summary:
related to T12015
- added basic unit tests (without auth for a smaller diff)
- further simplified tests in publish_receive.cpp

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27417
2024-01-18 08:14:45 +01:00
Bruno Iljazovic
4f87b27861 async_run
Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D27342
2024-01-16 13:18:21 +01:00
Bruno Iljazovic
d78fdd3208 use associated executors for intermediate handlers
Summary: * per-operation cancellation changed: total/partial signals only prevent further resending, terminal signal cancels the whole client

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D27246
2024-01-09 16:35:16 +01:00
Korina Šimičević
123e70d8fe Improved CONNECT & CONNACK property client functions
Summary: related to T13427

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27218
2024-01-05 08:03:38 +01:00
Korina Šimičević
bf81ab5ee7 Handle all warnings on MSVC Win32
Summary: related to T13409

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27165
2024-01-02 16:04:18 +01:00
Korina Šimičević
794c72cb44 Handle all MSVC warnings
Summary: related to T13409

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27152
2024-01-02 11:50:15 +01:00
Korina Šimičević
7c0b9042d1 Allow user to modify CONNECT properties
Summary: related to T13332

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27108
2023-12-22 14:07:05 +01:00
Korina Šimičević
99f30b3880 control_packet::wire_data() returns std::string_view
Summary: related to T13332

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27099
2023-12-22 10:52:13 +01:00
Korina Šimičević
97d8a4ea86 Validate control packet size
Summary: resolves T13332

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Maniphest Tasks: T13332

Differential Revision: https://repo.mireo.local/D27000
2023-12-22 10:00:53 +01:00
Korina Šimičević
9af32a942b Properties & string validation
Summary: related to T13318

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D26975
2023-12-14 15:29:40 +01:00
Korina Šimičević
b275411ada Validate subscribe requests
Summary: resolves T13305

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Maniphest Tasks: T13305

Differential Revision: https://repo.mireo.local/D26954
2023-12-14 08:41:04 +01:00