-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug in transport_tcp #1050
Fix bug in transport_tcp #1050
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 -1, WSAGetLastError()=WSAEWOULDBLOCK/errno=EINPROGRESS | ||
(ret != 0 && last_socket_error() != ROS_SOCKETS_ASYNCHRONOUS_CONNECT_RETURN))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The added condition Can you please indent this line by another space (since the expression is nested within the open parenthesis from the line before). Also the additional parenthesis around this line are not necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hava modified the code format . |
||
{ | ||
ROSCPP_CONN_LOG_DEBUG("Connect to tcpros publisher [%s:%d] failed with error [%d, %s]", host.c_str(), port, ret, last_socket_error_string()); | ||
close(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this commented line be left in?
There is no comment near it to explain what is going on here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could indeed be removed since it doesn't match the behavior on Windows.