Skip to content

Commit

Permalink
add timerFactory stop when stop service (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull authored Nov 12, 2024
1 parent 1ecb7cc commit a7bc36c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
17 changes: 10 additions & 7 deletions bcos-boostssl/websocket/WsService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,24 @@ void WsService::stop()
}
m_running = false;

// stop ioc thread
if (m_ioservicePool)
{
m_ioservicePool->stop();
}

if (m_statTimer)
{
m_statTimer->stop();
}
if (m_timerFactory)
{
m_timerFactory.reset();
}

if (m_reconnectTimer)
{
m_reconnectTimer->stop();
}
// stop ioc thread
if (m_ioservicePool)
{
m_ioservicePool->stop();
}

WEBSOCKET_SERVICE(INFO) << LOG_BADGE("stop") << LOG_DESC("stop websocket service successfully");
}
Expand Down Expand Up @@ -309,7 +312,7 @@ void WsService::reconnect()
{
std::string connectedEndPoint = peer.detail();
auto session = getSession(connectedEndPoint);
if (session)
if (session && session->isConnected())
{
continue;
}
Expand Down
15 changes: 10 additions & 5 deletions cmake/CompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,16 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA

option(USE_LD_GOLD "Use GNU gold linker" ON)
if (USE_LD_GOLD)
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if ("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold")
endif ()
if("${LINKER}" MATCHES "gold")
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold")
endif()
elseif("${LINKER}" MATCHES "mold")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=mold")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=mold")
endif()
endif ()

# Additional GCC-specific compiler settings.
Expand Down

0 comments on commit a7bc36c

Please sign in to comment.