Skip to content

Commit

Permalink
fix gateway exist coredump
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Nov 12, 2024
1 parent 19ccb82 commit 23a09d8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
15 changes: 10 additions & 5 deletions cpp/cmake/CompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,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
2 changes: 1 addition & 1 deletion cpp/wedpr-main/common/NodeStarter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace ppc::node
{
template <typename T>
int startProgram(
int argc, const char* argv[], std::string const& binaryName, std::shared_ptr<T>& starter)
int argc, const char* argv[], std::string const& binaryName, std::shared_ptr<T> starter)
{
/// set LC_ALL
setDefaultOrCLocale();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ void GatewayRouterManager::start()
return;
}
m_running = true;
m_timer->start();
if (m_timer)
{
m_timer->start();
}
ROUTER_MGR_LOG(INFO) << LOG_DESC("start GatewayRouterManager success");
}

Expand All @@ -76,7 +79,10 @@ void GatewayRouterManager::stop()
return;
}
m_running = false;
m_timer->stop();
if (m_timer)
{
m_timer->stop();
}
ROUTER_MGR_LOG(INFO) << LOG_DESC("stop GatewayRouterManager success");
}

Expand Down
11 changes: 11 additions & 0 deletions cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ Service::Service(std::string const& _nodeID, RouterTableFactory::Ptr const& _rou
boost::bind(&Service::onP2PDisconnect, this, boost::placeholders::_1));
}

void Service::stop()
{
SERVICE_LOG(INFO) << LOG_DESC("stop service");
// stop the timerFactory
if (m_timerFactory)
{
m_timerFactory.reset();
}
WsService::stop();
}

void Service::onP2PConnect(WsSession::Ptr _session)
{
SERVICE_LOG(INFO) << LOG_DESC("Receive new p2p connection")
Expand Down
2 changes: 2 additions & 0 deletions cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class Service : public bcos::boostssl::ws::WsService
m_deleteSessionHandlers.emplace_back(_handler);
}

void stop() override;

protected:
void onRecvMessage(bcos::boostssl::MessageFace::Ptr _msg,
bcos::boostssl::ws::WsSession::Ptr _session) override;
Expand Down

0 comments on commit 23a09d8

Please sign in to comment.