Skip to content
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

Fix for declaration after executable block #341

Merged
merged 2 commits into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 12 additions & 6 deletions examples/mqttnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,10 @@ static int NetConnect(void *context, const char* host, word16 port,
/* set default error case */
rc = MQTT_CODE_ERROR_NETWORK;
#ifdef WOLFMQTT_NONBLOCK
/* Check for error */
GET_SOCK_ERROR(sock->fd, SOL_SOCKET, SO_ERROR, so_error);
{
/* Check for error */
GET_SOCK_ERROR(sock->fd, SOL_SOCKET, SO_ERROR, so_error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and wrap the other instances of GET_SOCK_ERROR also, in NetWrite and NetRead_ex

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
if (
#ifndef _WIN32
(errno == EINPROGRESS) ||
Expand Down Expand Up @@ -681,8 +683,10 @@ static int NetWrite(void *context, const byte* buf, int buf_len,

rc = (int)SOCK_SEND(sock->fd, buf, buf_len, 0);
if (rc == -1) {
/* Get error */
GET_SOCK_ERROR(sock->fd, SOL_SOCKET, SO_ERROR, so_error);
{
/* Get error */
GET_SOCK_ERROR(sock->fd, SOL_SOCKET, SO_ERROR, so_error);
}
if (so_error == 0) {
#if defined(USE_WINDOWS_API) && defined(WOLFMQTT_NONBLOCK)
/* assume non-blocking case */
Expand Down Expand Up @@ -846,8 +850,10 @@ static int NetRead_ex(void *context, byte* buf, int buf_len,
rc = MQTT_CODE_ERROR_TIMEOUT;
}
else if (rc < 0) {
/* Get error */
GET_SOCK_ERROR(sock->fd, SOL_SOCKET, SO_ERROR, so_error);
{
/* Get error */
GET_SOCK_ERROR(sock->fd, SOL_SOCKET, SO_ERROR, so_error);
}
if (so_error == 0) {
rc = 0; /* Handle signal */
}
Expand Down