Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Avoid twice connect() in source code (closes #194)

  • Loading branch information...
commit 29851c2fa945499ec35b98338173ff37b1f6c5c8 1 parent dcfac5a
@stephane authored
Showing with 1 addition and 5 deletions.
  1. +1 −5 src/modbus-tcp.c
View
6 src/modbus-tcp.c
@@ -266,20 +266,16 @@ static int _modbus_tcp_set_ipv4_options(int s)
static int _connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen,
const struct timeval *ro_tv)
{
- int rc;
+ int rc = connect(sockfd, addr, addrlen);
#ifdef OS_WIN32
int wsaError = 0;
-
- rc = connect(sockfd, addr, addrlen);
if (rc == -1) {
wsaError = WSAGetLastError();
}
if (wsaError == WSAEWOULDBLOCK || wsaError == WSAEINPROGRESS) {
#else
-
- rc = connect(sockfd, addr, addrlen);
if (rc == -1 && errno == EINPROGRESS) {
#endif
fd_set wset;
Please sign in to comment.
Something went wrong with that request. Please try again.