Skip to content

Commit

Permalink
remove static modelName
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull committed Oct 22, 2024
1 parent 6b09c39 commit aba75fd
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion bcos-boostssl/context/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


#define CONTEXT_LOG(LEVEL) BCOS_LOG(LEVEL) << LOG_BADGE(m_moduleName) << "[BOOSTSSL][CTX]"
#define NODEINFO_LOG(LEVEL) BCOS_LOG(LEVEL) << LOG_BADGE(m_moduleName) << "[BOOSTSSL][NODEINFO]"
#define NODEINFO_LOG(LEVEL) BCOS_LOG(LEVEL) << "[BOOSTSSL][NODEINFO]"

namespace bcos
{ // namespace bcos
Expand Down
5 changes: 0 additions & 5 deletions bcos-boostssl/context/NodeInfoTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ namespace boostssl
{
namespace context
{
static std::string m_moduleName = "DEFAULT";

class NodeInfoTools
{
public:
Expand All @@ -42,9 +40,6 @@ class NodeInfoTools

static std::function<bool(bool, boost::asio::ssl::verify_context&)> newVerifyCallback(
std::shared_ptr<std::string> nodeIDOut);

static std::string moduleName() { return m_moduleName; }
static void setModuleName(std::string _moduleName) { m_moduleName = _moduleName; }
};

} // namespace context
Expand Down
2 changes: 1 addition & 1 deletion bcos-boostssl/websocket/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <boost/beast/websocket.hpp>

#define BOOST_SSL_LOG(LEVEL) BCOS_LOG(LEVEL) << "[BOOSTSSL]"
#define WEBSOCKET_TOOL(LEVEL) BCOS_LOG(LEVEL) << LOG_BADGE(m_moduleName) << "[WS][TOOL]"
#define WEBSOCKET_TOOL(LEVEL) BCOS_LOG(LEVEL) << "[WS][TOOL]"
#define WEBSOCKET_CONNECTOR(LEVEL) BCOS_LOG(LEVEL) << LOG_BADGE(m_moduleName) << "[WS][CONNECTOR]"
#define WEBSOCKET_VERSION(LEVEL) BCOS_LOG(LEVEL) << LOG_BADGE(m_moduleName) << "[WS][VERSION]"
#define WEBSOCKET_SESSION(LEVEL) BCOS_LOG(LEVEL) << LOG_BADGE(m_moduleName) << "[WS][SESSION]"
Expand Down
11 changes: 4 additions & 7 deletions bcos-boostssl/websocket/WsInitializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ using namespace bcos::boostssl::http;
void WsInitializer::initWsService(WsService::Ptr _wsService)
{
std::shared_ptr<WsConfig> _config = m_config;
std::string m_moduleName = _config->moduleName();
auto messageFactory = m_messageFactory;
if (!messageFactory)
{
Expand Down Expand Up @@ -76,9 +75,7 @@ void WsInitializer::initWsService(WsService::Ptr _wsService)
auto threadPool = std::make_shared<ThreadPool>("t_ws_pool", threadPoolSize);

// init module_name for log
WsTools::setModuleName(m_moduleName);
NodeInfoTools::setModuleName(m_moduleName);
connector->setModuleName(m_moduleName);
connector->setModuleName(_config->moduleName());

std::shared_ptr<boost::asio::ssl::context> srvCtx = nullptr;
std::shared_ptr<boost::asio::ssl::context> clientCtx = nullptr;
Expand All @@ -87,8 +84,8 @@ void WsInitializer::initWsService(WsService::Ptr _wsService)
auto contextBuilder = std::make_shared<ContextBuilder>();

// init module_name for log
contextBuilder->setModuleName(m_moduleName);
_config->contextConfig()->setModuleName(m_moduleName);
contextBuilder->setModuleName(_config->moduleName());
_config->contextConfig()->setModuleName(_config->moduleName());

srvCtx = contextBuilder->buildSslContext(true, *_config->contextConfig());
clientCtx = contextBuilder->buildSslContext(false, *_config->contextConfig());
Expand All @@ -114,7 +111,7 @@ void WsInitializer::initWsService(WsService::Ptr _wsService)

auto httpServerFactory = std::make_shared<HttpServerFactory>();
auto httpServer = httpServerFactory->buildHttpServer(_config->listenIP(),
_config->listenPort(), ioServicePool->getIOService(), srvCtx, m_moduleName);
_config->listenPort(), ioServicePool->getIOService(), srvCtx, _config->moduleName());
httpServer->setIOServicePool(ioServicePool);
httpServer->setDisableSsl(_config->disableSsl());
httpServer->setThreadPool(threadPool);
Expand Down
4 changes: 0 additions & 4 deletions bcos-boostssl/websocket/WsTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ namespace boostssl
{
namespace ws
{
static std::string m_moduleName = "DEFAULT";
class WsTools
{
public:
Expand All @@ -54,9 +53,6 @@ class WsTools
static bool stringToEndPoint(const std::string& peer, NodeIPEndpoint& _endpoint);

static void close(boost::asio::ip::tcp::socket& skt);

static std::string moduleName() { return m_moduleName; }
static void setModuleName(std::string _moduleName) { m_moduleName = _moduleName; }
};
} // namespace ws
} // namespace boostssl
Expand Down

0 comments on commit aba75fd

Please sign in to comment.