Skip to content

change static timer in keepalive func to regular timer #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add close session for mqtt client in order to set is_connected to fal…
…se after socket is closed
  • Loading branch information
IdoStern9 committed May 26, 2024
commit 4be654a389f947fc848a40a830d7c081a228c2dc
6 changes: 2 additions & 4 deletions paho_mqtt_embedded_c/MQTTClient/src/MQTTClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ class Client
{

public:

typedef void (*messageHandler)(MessageData&);

/** Construct the client
Expand Down Expand Up @@ -234,10 +233,9 @@ class Client
{
return isconnected;
}

private:

void closeSession();

private:
void cleanSession();
int cycle(Timer& timer);
int waitfor(int packet_type, Timer& timer);
Expand Down
5 changes: 5 additions & 0 deletions src/MQTTClientMbedOs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,8 @@ void MQTTClient::init(Socket *sock)
client = NULL;
clientSN = NULL;
}

void MQTTClient::mqttClientCloseSession()
{
client->closeSession();
}
2 changes: 2 additions & 0 deletions src/MQTTClientMbedOs.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ class MQTTClient {
*/
nsapi_error_t setMessageHandler(const char *topicFilter, messageHandler mh);

void mqttClientCloseSession();

private:
/**
* @brief Helper function to initialize member variables.
Expand Down