Skip to content

Commit

Permalink
Merge pull request #414 from embhorn/zd19107
Browse files Browse the repository at this point in the history
Fix stat reset for ping response
  • Loading branch information
dgarske authored Jan 29, 2025
2 parents d5b9743 + 595f202 commit 7e701ba
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CIFuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Build Fuzzers
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
# Install cmake
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-Espressif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
espressif_latest:
name: latest Docker container
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
# This should be a safe limit for the tests to run.
timeout-minutes: 12
container:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fsanitize-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
WOLFMQTT_NO_EXTERNAL_BROKER_TESTS: 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mqtt-sn-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 5

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-check-curl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 5

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 5

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/zephyr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
config:
- zephyr-ref: v3.4.0
zephyr-sdk: 0.16.1
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:

Expand All @@ -37,7 +37,7 @@ jobs:
libglib2.0-dev libgtk2.0-0 liblocale-gettext-perl libncurses5-dev libpcap-dev \
libpopt0 libsdl1.2-dev libsdl2-dev libssl-dev libtool libtool-bin locales make \
net-tools ninja-build openssh-client parallel pkg-config python3-dev python3-pip \
python3-ply python3-setuptools python-is-python3 qemu rsync socat srecord sudo \
python3-ply python3-setuptools python-is-python3 qemu-kvm rsync socat srecord sudo \
texinfo unzip wget ovmf xz-utils
- name: Install west
Expand Down
22 changes: 14 additions & 8 deletions src/mqtt_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,13 @@ static int MqttClient_WaitType(MqttClient *client, void *packet_obj,
client->packet.buf_len, packet_type, packet_id);
#endif

mms_stat->read = MQTT_MSG_PAYLOAD;
/* Ping response is special case, no payload */
if (packet_type != MQTT_PACKET_TYPE_PING_RESP) {
mms_stat->read = MQTT_MSG_PAYLOAD;
}
else {
mms_stat->read = MQTT_MSG_WAIT;
}
}
FALL_THROUGH;

Expand Down Expand Up @@ -1446,13 +1452,6 @@ static int MqttClient_WaitType(MqttClient *client, void *packet_obj,
break;
} /* switch (mms_stat->ack) */

#ifdef WOLFMQTT_DEBUG_CLIENT
if (rc != MQTT_CODE_CONTINUE) {
PRINTF("MqttClient_WaitType: rc %d, state %d-%d-%d",
rc, mms_stat->read, mms_stat->write, mms_stat->ack);
}
#endif

/* no data read or ack done, then reset state */
if (mms_stat->read == MQTT_MSG_WAIT) {
mms_stat->read = MQTT_MSG_BEGIN;
Expand Down Expand Up @@ -1507,6 +1506,13 @@ static int MqttClient_WaitType(MqttClient *client, void *packet_obj,
MQTT_TRACE_MSG("Wait Again");
goto wait_again;
}
#ifdef WOLFMQTT_DEBUG_CLIENT
if (rc != MQTT_CODE_CONTINUE) {
PRINTF("MqttClient_WaitType: rc %d, state %d-%d-%d",
rc, mms_stat->read, mms_stat->write, mms_stat->ack);
}
#endif


return rc;
}
Expand Down

0 comments on commit 7e701ba

Please sign in to comment.