Fix PhysicsServer connection issue, in cases where shared memory was not properly shut down.
This commit is contained in:
@@ -460,6 +460,10 @@ bool PhysicsServerSharedMemory::connectSharedMemory( struct GUIHelperInterface*
|
||||
}
|
||||
|
||||
|
||||
int counter = 0;
|
||||
do
|
||||
{
|
||||
|
||||
m_data->m_testBlock1 = (SharedMemoryBlock*)m_data->m_sharedMemory->allocateSharedMemory(m_data->m_sharedMemoryKey, SHARED_MEMORY_SIZE,allowCreation);
|
||||
if (m_data->m_testBlock1)
|
||||
{
|
||||
@@ -479,7 +483,6 @@ bool PhysicsServerSharedMemory::connectSharedMemory( struct GUIHelperInterface*
|
||||
m_data->m_isConnected = true;
|
||||
} else
|
||||
{
|
||||
b3Error("Server cannot connect to existing shared memory, disconnecting shared memory.\n");
|
||||
m_data->m_sharedMemory->releaseSharedMemory(m_data->m_sharedMemoryKey, SHARED_MEMORY_SIZE);
|
||||
m_data->m_testBlock1 = 0;
|
||||
m_data->m_isConnected = false;
|
||||
@@ -489,6 +492,12 @@ bool PhysicsServerSharedMemory::connectSharedMemory( struct GUIHelperInterface*
|
||||
b3Error("Cannot connect to shared memory");
|
||||
m_data->m_isConnected = false;
|
||||
}
|
||||
} while (counter++ < 10 && !m_data->m_isConnected);
|
||||
|
||||
if (!m_data->m_isConnected)
|
||||
{
|
||||
b3Error("Server cannot connect to shared memory.\n");
|
||||
}
|
||||
return m_data->m_isConnected;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user