1
0
mirror of https://gitlab.com/obbart/universal_robots_ros_driver.git synced 2026-04-10 18:10:47 +02:00

Merge pull request #1 from TAMS-Group/fork_master

Fix runtime issues
This commit is contained in:
Simon Rasmussen
2017-07-24 18:49:45 +02:00
committed by GitHub
5 changed files with 27 additions and 14 deletions

View File

@@ -60,10 +60,14 @@ bool URServer::accept()
struct sockaddr addr;
socklen_t addr_len;
int client_fd = ::accept(getSocketFD(), &addr, &addr_len);
int client_fd = -1;
if (client_fd <= 0)
return false;
int retry = 0;
while((client_fd = ::accept(getSocketFD(), &addr, &addr_len)) == -1){
LOG_ERROR("Accepting socket connection failed. (errno: %d)", errno);
if(retry++ >= 5)
return false;
}
TCPSocket::setOptions(client_fd);
@@ -81,4 +85,4 @@ void URServer::disconnectClient()
bool URServer::write(const uint8_t* buf, size_t buf_len, size_t& written)
{
return client_.write(buf, buf_len, written);
}
}