Commit Graph

129 Commits

Author SHA1 Message Date
Korina Šimičević
8dfbdf2d38 Update publisher and receiver examples
Summary:
related to T12804
publisher example will now showcase how to publish a message every 5 seconds
receiver example will now show how to subscribe, indefinitely receive messages and resubscribe if needed

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28472
2024-03-15 15:23:33 +01:00
Korina Šimičević
4b65ffc194 Add a chapter on disconnection
Summary: related to T12804

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28465
2024-03-15 07:39:58 +01:00
Korina Šimičević
bbcc7b1cd0 Add a chapter on optimising communication (multiflight, packet queing)
Summary: related to T12804

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28440
2024-03-13 15:00:02 +01:00
Korina Šimičević
5886fbf82b Add a chapter on maintaing a healthy connection (keep alive, ping, read timeout)
Summary: related to T12804

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28240
2024-03-12 12:32:17 +01:00
Korina Šimičević
f34705d74e Add a chapter on auto-reconnect and retry mechanism
Summary: related to T12804

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28198
2024-02-29 14:19:28 +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
Korina Šimičević
3abacf7a41 Documentation rework - add Configuring the Client chapter
Summary: related to T12804

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28182
2024-02-28 10:30:32 +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
v1.0.1
2024-02-23 14:40:00 +01:00
Korina Šimičević
2f055e8894 Remove connection error codes
Summary: related to T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28117
2024-02-23 14:01:28 +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ć
c51b570f6a Document per-operation cancellation for all asynchronous operations
Summary:
related to T12804
- document per-operation cancellation for all async ops
- async_disconnect no longer copies documentation from other overload

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28085
2024-02-22 13:10:58 +01:00
Korina Šimičević
29054b4f3c Move any_authenticator, control_packet and pid_allocator to detail namespace
Summary: related to T13767

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D28084
2024-02-22 12:37:01 +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
Bruno Iljazovic
22d3b644c5 add subscription_identifers unit test
Reviewers: korina

Reviewed By: korina

Differential Revision: https://repo.mireo.local/D28003
2024-02-19 14:19:24 +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
38f2cb2496 Add bool conversion operator to subscription_identifiers.
Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D27993
2024-02-19 12:03:00 +01:00
Bruno Iljazovic
03f37345b6 Remove temporaries from co_awaited expressions.
Summary: - some older gcc versions don't handle temporaries in co_awaited expressions correctly, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98401

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D27990
2024-02-19 11:54:15 +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ć
b40ddb3ced Separate tests to compile and run all configuration-related client functions
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27945
2024-02-16 07:38:58 +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
Korina Šimičević
3454a180ff Fix missing boost namespace in README
Summary: related to T12804, closes #6

Reviewers: iljazovic

Reviewed By: iljazovic

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D27933
2024-02-15 10:33:27 +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ć
aeab5f9665 Update documentation
Summary:
related to T12804
- fixes in publisher and receiver examples
- update year to 2024
- remove extra documentation link in README
- remove unnecessary copyright & license section, it is automatically generated from 00_main.qbk

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27889
2024-02-14 07:55:52 +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ć
0de02e3c53 Add async mutex unit tests
Summary:
related to T12015
- relax coroutine tests
- add async mutex unit tests

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27719
2024-02-06 07:44:05 +01:00
Korina Šimičević
5c7f0bc29d Add missing malformed tests for publish packets
Summary:
related to T12015
- all malformed cases should now be fully covered!
- additionally, added a receive channel overflow test

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27709
2024-02-05 07:54:08 +01:00
Korina Šimičević
677e625d1a Simplify usage of subscribe options enums
Summary: related to T13606

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27679
2024-02-02 10:21:03 +01:00
Korina Šimičević
46a48fb62c Fix Win32 build
Summary: related to T11798

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27668
2024-02-01 15:00:22 +01:00
Korina Šimičević
e143fcce63 Fix initialization
Summary: related to T12015

Reviewers: iljazovic

Reviewed By: iljazovic

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D27664
2024-02-01 11:00:05 +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ć
21d90a9fda Simplify integration (un)subscribe & sender related tests
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27519
2024-01-23 15:32:50 +01:00
Korina Šimičević
05ae2f5562 Simplify integration publish tests
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27511
2024-01-23 13:22:26 +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ć
9b92f7fca2 Simplify and shorten unit test code - part 1
Summary: related to T12015

Reviewers: ivica

Reviewed By: ivica

Subscribers: miljen, iljazovic

Differential Revision: https://repo.mireo.local/D27488
2024-01-23 07:54:38 +01:00
Bruno Iljazovic
28bf23947d increase run_for duration in cancellation tests
Reviewers: ljudevit

Reviewed By: ljudevit

Subscribers: korina

Differential Revision: https://repo.mireo.local/D27476
2024-01-19 17:29:52 +01:00