Skip to content

Commit

Permalink
Add curl easy socket backend: fix warning, fix multithread test.
Browse files Browse the repository at this point in the history
  • Loading branch information
philljj committed Dec 8, 2023
1 parent d98607e commit c329ef7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/mqttnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ static int
mqttcurl_connect(SocketContext * sock, const char* host, word16 port,
int timeout_ms)
{
CURLcode res = 0;
CURLcode res = CURLE_OK;

if (sock == NULL) {
return MQTT_CODE_ERROR_BAD_ARG;
Expand Down Expand Up @@ -644,7 +644,7 @@ static int NetConnect(void *context, const char* host, word16 port,
static int NetWrite(void *context, const byte* buf, int buf_len,
int timeout_ms)
{
CURLcode res = 0;
CURLcode res = CURLE_OK;
SocketContext * sock = (SocketContext*)context;
size_t sent = 0;
curl_socket_t sockfd = 0;
Expand Down Expand Up @@ -711,7 +711,7 @@ static int NetWrite(void *context, const byte* buf, int buf_len,
static int NetRead(void *context, byte* buf, int buf_len,
int timeout_ms)
{
CURLcode res = 0;
CURLcode res = CURLE_OK;
SocketContext * sock = (SocketContext*)context;
size_t recvd = 0;
curl_socket_t sockfd = 0;
Expand Down
7 changes: 4 additions & 3 deletions scripts/multithread.test
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ then
def_args="${def_args} -h localhost"
tls_port_args="-p 18883"
port_args="-p ${port}"
cacert_args="-A scripts/broker_test/ca-cert.pem"
fi

echo -e "Base args: $def_args $port_args"
Expand All @@ -92,15 +93,15 @@ RESULT=$?
if test $has_tls == yes
then
# Run with TLS and QoS 0-2
./examples/multithread/multithread $def_args $tls_port_args -t -q 0 $1
./examples/multithread/multithread $def_args $cacert_args $tls_port_args -t -q 0 $1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "\n\nMultithread Client failed! TLS=On, QoS=0" && do_cleanup "-1"

./examples/multithread/multithread $def_args $tls_port_args -t -q 1 $1
./examples/multithread/multithread $def_args $cacert_args $tls_port_args -t -q 1 $1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "\n\nMultithread Client failed! TLS=On, QoS=1" && do_cleanup "-1"

./examples/multithread/multithread $def_args $tls_port_args -t -q 2 $1
./examples/multithread/multithread $def_args $cacert_args $tls_port_args -t -q 2 $1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "\n\nMultithread Client failed! TLS=On, QoS=2" && do_cleanup "-1"
fi
Expand Down

0 comments on commit c329ef7

Please sign in to comment.