Skip to content

Commit

Permalink
Do not change the behavior for non-windows OS.
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedmz authored and stephane committed Aug 17, 2022
1 parent c0ee9df commit 9b679b7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/modbus.c
Expand Up @@ -182,8 +182,7 @@ static int send_msg(modbus_t *ctx, uint8_t *msg, int msg_length)
rc = ctx->backend->send(ctx, msg, msg_length);
if (rc == -1) {
_error_print(ctx, NULL);
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_LINK &&
ctx->backend->backend_type == _MODBUS_BACKEND_TYPE_TCP) {
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_LINK) {
#ifdef _WIN32
const int wsa_err = WSAGetLastError();
if (wsa_err == WSAENETRESET || wsa_err == WSAENOTCONN || wsa_err == WSAENOTSOCK ||
Expand Down Expand Up @@ -404,8 +403,7 @@ int _modbus_receive_msg(modbus_t *ctx, uint8_t *msg, msg_type_t msg_type)
rc = ctx->backend->select(ctx, &rset, p_tv, length_to_read);
if (rc == -1) {
_error_print(ctx, "select");
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_LINK &&
ctx->backend->backend_type == _MODBUS_BACKEND_TYPE_TCP) {
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_LINK) {
#ifdef _WIN32
wsa_err = WSAGetLastError();

Expand Down

0 comments on commit 9b679b7

Please sign in to comment.