Skip to content

Commit 392a4e5

Browse files
committed
Fixes for Broker on MacOS (enable broker with --enable-all)
1 parent f1b2e91 commit 392a4e5

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ then
158158
test "$enable_v5" = "" && enable_v5=yes
159159
test "$enable_discb" = "" && enable_discb=yes
160160
test "$enable_mt" = "" && enable_mt=yes
161-
test "$enable_" = "" && enable_=yes
161+
test "$enable_broker" = "" && enable_broker=yes
162162
fi
163163

164164
# TLS Support with wolfSSL

scripts/broker.test

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ wait_for_file() {
7070
local file="$1"
7171
local timeout_sec="${2:-5}"
7272
local waited=0
73-
while [ ! -f "$file" ] && [ $waited -lt $timeout_sec ]; do
73+
local max_iters=$((timeout_sec * 10))
74+
while [ ! -f "$file" ] && [ $waited -lt $max_iters ]; do
7475
sleep 0.1
75-
waited=$(echo "$waited + 0.1" | bc)
76+
waited=$((waited + 1))
7677
done
7778
[ -f "$file" ]
7879
}

src/mqtt_packet.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,9 @@ int MqttEncode_Props(MqttPacketType packet, MqttProp* props, byte* buf)
441441
}
442442
case MQTT_DATA_TYPE_STRING:
443443
{
444-
tmp = MqttEncode_String(buf,
445-
(const char*)cur_prop->data_str.str);
444+
tmp = MqttEncode_Data(buf,
445+
(const byte*)cur_prop->data_str.str,
446+
cur_prop->data_str.len);
446447
rc += tmp;
447448
if (buf != NULL) {
448449
buf += tmp;
@@ -475,15 +476,17 @@ int MqttEncode_Props(MqttPacketType packet, MqttProp* props, byte* buf)
475476
{
476477
/* String is prefixed with a Two Byte Integer length field that
477478
gives the number of bytes */
478-
tmp = MqttEncode_String(buf,
479-
(const char*)cur_prop->data_str.str);
479+
tmp = MqttEncode_Data(buf,
480+
(const byte*)cur_prop->data_str.str,
481+
cur_prop->data_str.len);
480482
rc += tmp;
481483
if (buf != NULL) {
482484
buf += tmp;
483485
}
484486

485-
tmp = MqttEncode_String(buf,
486-
(const char*)cur_prop->data_str2.str);
487+
tmp = MqttEncode_Data(buf,
488+
(const byte*)cur_prop->data_str2.str,
489+
cur_prop->data_str2.len);
487490
rc += tmp;
488491
if (buf != NULL) {
489492
buf += tmp;
@@ -2681,9 +2684,9 @@ int MqttProps_Init(void)
26812684
int ret = MQTT_CODE_SUCCESS;
26822685
#if !defined(WOLFMQTT_DYN_PROP) && defined(WOLFMQTT_MULTITHREAD)
26832686
if (clientPropStack_lockInit == 0) {
2684-
clientPropStack_lockInit++;
26852687
ret = wm_SemInit(&clientPropStack_lock);
26862688
}
2689+
clientPropStack_lockInit++;
26872690
#endif
26882691
return ret;
26892692
}

0 commit comments

Comments
 (0)