Commit 9b679b7c3b267f7a5d87e26b8f94138edd76f1d9

Authored by Mohamed Amine Mzoughi
Committed by Stéphane Raimbault
1 parent c0ee9dfe

Do not change the behavior for non-windows OS.

Showing 1 changed file with 2 additions and 4 deletions
src/modbus.c
@@ -182,8 +182,7 @@ static int send_msg(modbus_t *ctx, uint8_t *msg, int msg_length) @@ -182,8 +182,7 @@ static int send_msg(modbus_t *ctx, uint8_t *msg, int msg_length)
182 rc = ctx->backend->send(ctx, msg, msg_length); 182 rc = ctx->backend->send(ctx, msg, msg_length);
183 if (rc == -1) { 183 if (rc == -1) {
184 _error_print(ctx, NULL); 184 _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) {
187 #ifdef _WIN32 186 #ifdef _WIN32
188 const int wsa_err = WSAGetLastError(); 187 const int wsa_err = WSAGetLastError();
189 if (wsa_err == WSAENETRESET || wsa_err == WSAENOTCONN || wsa_err == WSAENOTSOCK || 188 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) @@ -404,8 +403,7 @@ int _modbus_receive_msg(modbus_t *ctx, uint8_t *msg, msg_type_t msg_type)
404 rc = ctx->backend->select(ctx, &rset, p_tv, length_to_read); 403 rc = ctx->backend->select(ctx, &rset, p_tv, length_to_read);
405 if (rc == -1) { 404 if (rc == -1) {
406 _error_print(ctx, "select"); 405 _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) {
409 #ifdef _WIN32 407 #ifdef _WIN32
410 wsa_err = WSAGetLastError(); 408 wsa_err = WSAGetLastError();
411 409