Skip to content

Commit 23a09d8

Browse files
committed
fix gateway exist coredump
1 parent 19ccb82 commit 23a09d8

File tree

5 files changed

+32
-8
lines changed

5 files changed

+32
-8
lines changed

cpp/cmake/CompilerSettings.cmake

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,16 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
7575

7676
option(USE_LD_GOLD "Use GNU gold linker" ON)
7777
if (USE_LD_GOLD)
78-
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
79-
if ("${LD_VERSION}" MATCHES "GNU gold")
80-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
81-
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold")
82-
endif ()
78+
if("${LINKER}" MATCHES "gold")
79+
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
80+
if("${LD_VERSION}" MATCHES "GNU gold")
81+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
82+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold")
83+
endif()
84+
elseif("${LINKER}" MATCHES "mold")
85+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=mold")
86+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=mold")
87+
endif()
8388
endif ()
8489

8590
# Additional GCC-specific compiler settings.

cpp/wedpr-main/common/NodeStarter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace ppc::node
2929
{
3030
template <typename T>
3131
int startProgram(
32-
int argc, const char* argv[], std::string const& binaryName, std::shared_ptr<T>& starter)
32+
int argc, const char* argv[], std::string const& binaryName, std::shared_ptr<T> starter)
3333
{
3434
/// set LC_ALL
3535
setDefaultOrCLocale();

cpp/wedpr-transport/ppc-gateway/ppc-gateway/gateway/router/GatewayRouterManager.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ void GatewayRouterManager::start()
6464
return;
6565
}
6666
m_running = true;
67-
m_timer->start();
67+
if (m_timer)
68+
{
69+
m_timer->start();
70+
}
6871
ROUTER_MGR_LOG(INFO) << LOG_DESC("start GatewayRouterManager success");
6972
}
7073

@@ -76,7 +79,10 @@ void GatewayRouterManager::stop()
7679
return;
7780
}
7881
m_running = false;
79-
m_timer->stop();
82+
if (m_timer)
83+
{
84+
m_timer->stop();
85+
}
8086
ROUTER_MGR_LOG(INFO) << LOG_DESC("stop GatewayRouterManager success");
8187
}
8288

cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ Service::Service(std::string const& _nodeID, RouterTableFactory::Ptr const& _rou
4848
boost::bind(&Service::onP2PDisconnect, this, boost::placeholders::_1));
4949
}
5050

51+
void Service::stop()
52+
{
53+
SERVICE_LOG(INFO) << LOG_DESC("stop service");
54+
// stop the timerFactory
55+
if (m_timerFactory)
56+
{
57+
m_timerFactory.reset();
58+
}
59+
WsService::stop();
60+
}
61+
5162
void Service::onP2PConnect(WsSession::Ptr _session)
5263
{
5364
SERVICE_LOG(INFO) << LOG_DESC("Receive new p2p connection")

cpp/wedpr-transport/ppc-gateway/ppc-gateway/p2p/Service.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ class Service : public bcos::boostssl::ws::WsService
8181
m_deleteSessionHandlers.emplace_back(_handler);
8282
}
8383

84+
void stop() override;
85+
8486
protected:
8587
void onRecvMessage(bcos::boostssl::MessageFace::Ptr _msg,
8688
bcos::boostssl::ws::WsSession::Ptr _session) override;

0 commit comments

Comments
 (0)