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

Close socket on error in NetConnect #375

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Conversation

embhorn
Copy link
Member

@embhorn embhorn commented Nov 27, 2023

Socket opened during NetConnect should be closed if there was an error during SOCK_CONNECT (except MQTT_CODE_CONTINUE)

@embhorn embhorn self-assigned this Nov 27, 2023
examples/mqttnet.c Outdated Show resolved Hide resolved
examples/mqttnet.c Show resolved Hide resolved
@embhorn
Copy link
Member Author

embhorn commented Nov 27, 2023

@efieleke-tausight

Interesting, yes, I changed it to use the existing disconnect which checks for a valid socket descriptor.

Copy link

@efieleke-tausight efieleke-tausight left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@embhorn embhorn requested a review from dgarske November 27, 2023 21:49
@embhorn embhorn assigned dgarske and unassigned embhorn Nov 27, 2023
if (sock) {
if (sock->fd != SOCKET_INVALID) {
SOCK_CLOSE(sock->fd);
sock->fd = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's fix this so sock->fd = SOCKET_INVALID.

@dgarske dgarske assigned embhorn and unassigned dgarske Nov 27, 2023
@dgarske dgarske merged commit fef107f into wolfSSL:master Nov 27, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants