Skip to content

Commit

Permalink
libros: Win10 WSL compat fix (wip).
Browse files Browse the repository at this point in the history
  • Loading branch information
gavanderhoorn committed May 9, 2017
1 parent c646e0f commit c83508d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clients/roscpp/src/libros/transport/transport_tcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,10 @@ bool TransportTCP::connect(const std::string& host, int port)

int ret = ::connect(sock_, (sockaddr*) &sas, sas_len);
// windows might need some time to sleep (input from service robotics hack) add this if testing proves it is necessary.
ROS_ASSERT((flags_ & SYNCHRONOUS) || ret != 0);
//ROS_ASSERT((flags_ & SYNCHRONOUS) || ret != 0);
if (((flags_ & SYNCHRONOUS) && ret != 0) || // synchronous, connect() should return 0
(!(flags_ & SYNCHRONOUS) && last_socket_error() != ROS_SOCKETS_ASYNCHRONOUS_CONNECT_RETURN)) // asynchronous, connect() should return -1 and WSAGetLastError()=WSAEWOULDBLOCK/errno=EINPROGRESS
(!(flags_ & SYNCHRONOUS) && // asynchronous, connect() may return 0 or -1. When return 0, WSAGetLastError()=WSAEWOULDBLOCK/errno=EINPROGRESS
(ret != 0 && last_socket_error() != ROS_SOCKETS_ASYNCHRONOUS_CONNECT_RETURN)))
{
ROSCPP_LOG_DEBUG("Connect to tcpros publisher [%s:%d] failed with error [%d, %s]", host.c_str(), port, ret, last_socket_error_string());
close();
Expand Down

0 comments on commit c83508d

Please sign in to comment.