Skip to content

Commit 7798308

Browse files
committed
Bugfix: (@webercheng)
1 parent ca8dd90 commit 7798308

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Source/ROSIntegration/Private/ROSIntegrationGameInstance.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void UROSIntegrationGameInstance::Init()
8686
if (!bTimerSet)
8787
{
8888
bTimerSet = true;
89-
GetTimerManager().SetTimer(TimerHandle_CheckHealth, this, &UROSIntegrationGameInstance::CheckROSBridgeHealth, 1.0f, true, 5.0f);
89+
GetTimerManager().SetTimer(TimerHandle_CheckHealth, this, &UROSIntegrationGameInstance::CheckROSBridgeHealth, 5.0f, true, 5.0f);
9090
}
9191

9292
if (bIsConnected)

Source/ROSIntegration/Private/rosbridge2cpp/TCPConnection.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,19 @@ bool TCPConnection::Init(std::string ip_addr, int port)
3939
std::cout << "Unable to set requested receiver buffer size" << std::endl;
4040
}*/
4141

42-
if (!_sock->Connect(*addr))
42+
bool bConnected = false;
43+
_sock->SetNonBlocking(true);
44+
bConnected = _sock->Connect(*addr);
45+
_sock->SetNonBlocking(false);
46+
// If using _sock->Wait also blocks
47+
if (bConnected ) //&& _sock->Wait(ESocketWaitConditions::WaitForWrite, FTimespan::FromSeconds(2)))
48+
{
49+
// do nothing
50+
}
51+
else
52+
{
4353
return false;
44-
54+
}
4555
// Setting up the receiver thread
4656
UE_LOG(LogROS, Display, TEXT("Setting up receiver thread ..."));
4757

0 commit comments

Comments
 (0)