Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
paho.mqtt.c
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eclipse
paho.mqtt.c
Commits
d0f87d58
Commit
d0f87d58
authored
Jul 02, 2018
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MQTT V5 async tests for shared subs, subs options and request response #470 471 487
parent
7dc676e5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
668 additions
and
5 deletions
+668
-5
MQTTAsync.c
src/MQTTAsync.c
+13
-3
CMakeLists.txt
test/CMakeLists.txt
+18
-0
test10.c
test/test10.c
+2
-2
test11.c
test/test11.c
+635
-0
No files found.
src/MQTTAsync.c
View file @
d0f87d58
...
...
@@ -3073,7 +3073,8 @@ int MQTTAsync_subscribeMany(MQTTAsync handle, int count, char* const* topic, int
rc
=
MQTTASYNC_NO_MORE_MSGIDS
;
goto
exit
;
}
if
(
m
->
c
->
MQTTVersion
>=
MQTTVERSION_5
&&
count
>
1
&&
count
!=
response
->
subscribe_options_count
)
if
(
m
->
c
->
MQTTVersion
>=
MQTTVERSION_5
&&
count
>
1
&&
(
count
!=
response
->
subscribe_options_count
&&
response
->
subscribe_options_count
!=
0
))
{
rc
=
MQTTASYNC_BAD_MQTT_OPTIONS
;
goto
exit
;
...
...
@@ -3099,8 +3100,17 @@ int MQTTAsync_subscribeMany(MQTTAsync handle, int count, char* const* topic, int
if
(
count
>
1
)
{
sub
->
command
.
details
.
sub
.
optlist
=
malloc
(
sizeof
(
MQTTSubscribe_options
)
*
count
);
for
(
i
=
0
;
i
<
count
;
++
i
)
sub
->
command
.
details
.
sub
.
optlist
[
i
]
=
response
->
subscribe_options_list
[
i
];
if
(
response
->
subscribe_options_count
==
0
)
{
MQTTSubscribe_options
initialized
=
MQTTSubscribe_options_initializer
;
for
(
i
=
0
;
i
<
count
;
++
i
)
sub
->
command
.
details
.
sub
.
optlist
[
i
]
=
initialized
;
}
else
{
for
(
i
=
0
;
i
<
count
;
++
i
)
sub
->
command
.
details
.
sub
.
optlist
[
i
]
=
response
->
subscribe_options_list
[
i
];
}
}
}
}
...
...
test/CMakeLists.txt
View file @
d0f87d58
...
...
@@ -672,6 +672,21 @@ ADD_TEST(
COMMAND
"test11"
"--test_no"
"6"
"--connection"
${
MQTT_TEST_BROKER
}
"--proxy_connection"
${
MQTT_TEST_PROXY
}
)
ADD_TEST
(
NAME test11-7-request_response
COMMAND
"test11"
"--test_no"
"7"
"--connection"
${
MQTT_TEST_BROKER
}
"--proxy_connection"
${
MQTT_TEST_PROXY
}
)
ADD_TEST
(
NAME test11-8-subscribe_options
COMMAND
"test11"
"--test_no"
"8"
"--connection"
${
MQTT_TEST_BROKER
}
"--proxy_connection"
${
MQTT_TEST_PROXY
}
)
ADD_TEST
(
NAME test11-9-shared_subscriptions
COMMAND
"test11"
"--test_no"
"9"
"--connection"
${
MQTT_TEST_BROKER
}
"--proxy_connection"
${
MQTT_TEST_PROXY
}
)
SET_TESTS_PROPERTIES
(
test11-1-client_topic_aliases
test11-2-server_topic_aliases
...
...
@@ -679,6 +694,9 @@ SET_TESTS_PROPERTIES(
test11-4-flow_control
test11-5-error_handling
test11-6-qos_1_2_errors
test11-7-request_response
test11-8-subscribe_options
test11-9-shared_subscriptions
PROPERTIES TIMEOUT 540
)
...
...
test/test10.c
View file @
d0f87d58
...
...
@@ -1628,7 +1628,7 @@ struct
}
test_shared_subscriptions_globals
=
{
"$share/share_test/#"
,
"
#
"
,
"
a
"
,
0
,
};
...
...
@@ -1756,7 +1756,7 @@ int test_shared_subscriptions(struct Options options)
test_shared_subscriptions_globals
.
messages_arrived
=
0
;
for
(
i
=
0
;
i
<
10
;
++
i
)
{
response
=
MQTTClient_publishMessage5
(
c
,
test_s
ubscribe_o
ptions_globals
.
topic
,
&
pubmsg
,
&
dt
);
response
=
MQTTClient_publishMessage5
(
c
,
test_s
hared_subscri
ptions_globals
.
topic
,
&
pubmsg
,
&
dt
);
assert
(
"Good rc from publish"
,
response
.
reasonCode
==
MQTTCLIENT_SUCCESS
,
"rc was %d"
,
response
.
reasonCode
);
/* should get the request */
...
...
test/test11.c
View file @
d0f87d58
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment