Skip to content

Commit 9b679b7

Browse files
Mohamed Amine Mzoughistephane
authored andcommitted
Do not change the behavior for non-windows OS.
1 parent c0ee9df commit 9b679b7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/modbus.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ static int send_msg(modbus_t *ctx, uint8_t *msg, int msg_length)
182182
rc = ctx->backend->send(ctx, msg, msg_length);
183183
if (rc == -1) {
184184
_error_print(ctx, NULL);
185-
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_LINK &&
186-
ctx->backend->backend_type == _MODBUS_BACKEND_TYPE_TCP) {
185+
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_LINK) {
187186
#ifdef _WIN32
188187
const int wsa_err = WSAGetLastError();
189188
if (wsa_err == WSAENETRESET || wsa_err == WSAENOTCONN || wsa_err == WSAENOTSOCK ||
@@ -404,8 +403,7 @@ int _modbus_receive_msg(modbus_t *ctx, uint8_t *msg, msg_type_t msg_type)
404403
rc = ctx->backend->select(ctx, &rset, p_tv, length_to_read);
405404
if (rc == -1) {
406405
_error_print(ctx, "select");
407-
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_LINK &&
408-
ctx->backend->backend_type == _MODBUS_BACKEND_TYPE_TCP) {
406+
if (ctx->error_recovery & MODBUS_ERROR_RECOVERY_LINK) {
409407
#ifdef _WIN32
410408
wsa_err = WSAGetLastError();
411409

0 commit comments

Comments
 (0)