Skip to content

Commit

Permalink
Merge pull request eclipse-paho#1023 from fpagliughi/bool_update_conn…
Browse files Browse the repository at this point in the history
…ect_options

Removed hard-coded 1 as truth in updateConnectOptions callback return
  • Loading branch information
icraggs authored Dec 14, 2020
2 parents c004408 + edecc33 commit b283db8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/MQTTAsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,12 @@ typedef struct

#define MQTTAsync_connectData_initializer {{'M', 'Q', 'C', 'D'}, 0, NULL, {0, NULL}}

/**
* This is a callback function which will allow the client application to update the
* connection data.
* @param data The conneciton data which can be modified by the application.
* @return Return a non-zero value to update the connect data, zero to keep the same data.
*/
typedef int MQTTAsync_updateConnectOptions(void* context, MQTTAsync_connectData* data);

/**
Expand Down
2 changes: 1 addition & 1 deletion src/MQTTAsyncUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ static void MQTTAsync_checkTimeouts(void)
Log(TRACE_MIN, -1, "Calling updateConnectOptions for client %s", m->c->clientID);
callback_rc = (*(m->updateConnectOptions))(m->updateConnectOptions_context, &connectData);

if (callback_rc == 1)
if (callback_rc)
{
if (connectData.username != m->c->username)
{
Expand Down

0 comments on commit b283db8

Please sign in to comment.