Skip to content
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

Refs #5142 Fixing WAN [5144] #490

Merged
merged 1 commit into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions src/cpp/transport/TCPTransportInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -960,9 +960,32 @@ bool TCPTransportInterface::send(
std::shared_ptr<TCPChannelResource>& channel,
const Locator_t& remote_locator)
{
if (channel->locator() != IPLocator::toPhysicalLocator(remote_locator) ||
send_buffer_size > configuration()->sendBufferSize)
bool locator_mismatch = false;

if (channel->locator() != IPLocator::toPhysicalLocator(remote_locator))
{
locator_mismatch = true;
}

// Maybe is WAN?
if (locator_mismatch && IPLocator::hasWan(remote_locator))
{
Locator_t wan_locator;
wan_locator.kind = remote_locator.kind;
wan_locator.port = IPLocator::toPhysicalLocator(remote_locator).port;
IPLocator::setIPv4(wan_locator, IPLocator::toWanstring(remote_locator)); // WAN to IP
//std::cout << "WANLocator: " << IPLocator::to_string(wan_locator) << std::endl;
if(channel->locator() == wan_locator)
{
locator_mismatch = false;
}
}

if (locator_mismatch || send_buffer_size > configuration()->sendBufferSize)
{
//std::cout << "ChannelLocator: " << IPLocator::to_string(channel->locator()) << std::endl;
//std::cout << "RemoteLocator: " << IPLocator::to_string(remote_locator) << std::endl;

logWarning(RTCP, "SEND [RTPS] Failed: Not connect: " << IPLocator::getLogicalPort(remote_locator) \
<< " @ IP: " << IPLocator::toIPv4string(remote_locator));
return false;
Expand Down Expand Up @@ -1258,8 +1281,6 @@ bool TCPTransportInterface::fillMetatrafficUnicastLocator(
IPLocator::setLogicalPort(locator, static_cast<uint16_t>(metatraffic_unicast_port));
}

// TODO: Add WAN address

return true;
}

Expand Down Expand Up @@ -1329,8 +1350,6 @@ bool TCPTransportInterface::fillUnicastLocator(
IPLocator::setLogicalPort(locator, static_cast<uint16_t>(well_known_port));
}

// TODO: Add WAN address

return true;
}

Expand Down
28 changes: 15 additions & 13 deletions test/realtime/mutex_testing_tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@
include(${PROJECT_SOURCE_DIR}/cmake/common/gtest.cmake)
check_gtest()

add_library(mutex_testing_tool SHARED TMutex.cpp)
if(GTEST_FOUND)
add_library(mutex_testing_tool SHARED TMutex.cpp)

add_library(mutex_testing_tool_preload SHARED Mutex.cpp)
target_link_libraries(mutex_testing_tool_preload PRIVATE mutex_testing_tool ${CMAKE_DL_LIBS})
add_library(mutex_testing_tool_preload SHARED Mutex.cpp)
target_link_libraries(mutex_testing_tool_preload PRIVATE mutex_testing_tool ${CMAKE_DL_LIBS})

add_executable(TMutexTests TMutexTests.cpp)
target_include_directories(TMutexTests PRIVATE ${GTEST_INCLUDE_DIRS})
target_link_libraries(TMutexTests mutex_testing_tool ${GTEST_LIBRARIES})
STRING(REPLACE " " "\\ " MUTEX_PRELOAD_LIBRARY_FILE "$<TARGET_FILE:mutex_testing_tool_preload>")
add_gtest(TMutexTests SOURCES TMutexTests.cpp
ENVIRONMENTS
"LD_LIBRARY_PATH=$<TARGET_FILE_DIR:mutex_testing_tool_preload>"
"LD_PRELOAD=$<TARGET_FILE_NAME:mutex_testing_tool_preload>"
LABELS "NoMemoryCheck"
)
add_executable(TMutexTests TMutexTests.cpp)
target_include_directories(TMutexTests PRIVATE ${GTEST_INCLUDE_DIRS})
target_link_libraries(TMutexTests mutex_testing_tool ${GTEST_LIBRARIES})
STRING(REPLACE " " "\\ " MUTEX_PRELOAD_LIBRARY_FILE "$<TARGET_FILE:mutex_testing_tool_preload>")
add_gtest(TMutexTests SOURCES TMutexTests.cpp
ENVIRONMENTS
"LD_LIBRARY_PATH=$<TARGET_FILE_DIR:mutex_testing_tool_preload>"
"LD_PRELOAD=$<TARGET_FILE_NAME:mutex_testing_tool_preload>"
LABELS "NoMemoryCheck"
)
endif(GTEST_FOUND)