提交 8e735c3d 编写于 作者: W wujing 提交者: lifeng68

Moving the source of websocket services to service/cri

Signed-off-by: Nwujing <wujing50@huawei.com>
上级 1213121f
......@@ -69,7 +69,6 @@ if (GRPC_CONNECTOR)
)
add_subdirectory(cpputils)
add_subdirectory(websocket)
list(APPEND SHARED_SRCS ${CPPUTILS_SRCS})
else()
......@@ -153,7 +152,6 @@ add_executable(isulad
${PLUGIN_SRCS}
${CONFIG_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/libisulad.c
${WEBSOCKET_SERVICE_SRCS}
)
target_include_directories(isulad PUBLIC
......@@ -167,7 +165,6 @@ target_include_directories(isulad PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/plugin
${CMAKE_CURRENT_SOURCE_DIR}/config
${CMAKE_CURRENT_SOURCE_DIR}/http
${WEBSOCKET_SERVICE_INCS}
)
target_link_libraries(isulad ${LIBYAJL_LIBRARY} ${SYSTEMD_LIBRARY} ${SELINUX_LIBRARY} ${LIBARCHIVE_LIBRARY} ${LIBTAR_LIBRARY} ${WEBSOCKET_LIBRARY} ${CRYPTO_LIBRARY})
......
......@@ -3,9 +3,9 @@ aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/ services_top_srcs)
set(local_services_srcs ${services_top_srcs})
set(local_services_incs ${CMAKE_CURRENT_SOURCE_DIR})
if (GRPC_CONNECTOR)
add_subdirectory(cri)
list(APPEND local_services_srcs ${CRI_SRCS})
list(APPEND local_services_incs ${CMAKE_CURRENT_SOURCE_DIR}/cri)
add_subdirectory(cri)
list(APPEND local_services_srcs ${CRI_SRCS})
list(APPEND local_services_incs ${CRI_INCS})
endif()
add_subdirectory(execution)
list(APPEND local_services_srcs ${EXECUTION_SRCS})
......
# get current directory sources files
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} local_cri_srcs)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} cri_top_srcs)
set(local_cri_srcs ${cri_top_srcs})
set(local_cri_incs ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(websocket)
list(APPEND local_cri_srcs ${WEBSOCKET_SERVICE_SRCS})
list(APPEND local_cri_incs ${WEBSOCKET_SERVICE_INCS})
set(CRI_SRCS ${local_cri_srcs} PARENT_SCOPE)
set(CRI_INCS ${local_cri_incs} PARENT_SCOPE)
set(CRI_SRCS
${local_cri_srcs}
PARENT_SCOPE
)
......@@ -29,7 +29,7 @@
struct lws_context *WebsocketServer::m_context = nullptr;
std::atomic<WebsocketServer *> WebsocketServer::m_instance;
std::mutex WebsocketServer::m_mutex;
std::map<struct lws *, session_data> WebsocketServer::m_wsis;
std::unordered_map<struct lws *, session_data> WebsocketServer::m_wsis;
WebsocketServer *WebsocketServer::GetInstance() noexcept
{
WebsocketServer *server = m_instance.load(std::memory_order_relaxed);
......@@ -62,7 +62,7 @@ url::URLDatum WebsocketServer::GetWebsocketUrl()
return m_url;
}
std::map<struct lws *, session_data> &WebsocketServer::GetWsisData()
std::unordered_map<struct lws *, session_data> &WebsocketServer::GetWsisData()
{
return m_wsis;
}
......
......@@ -16,7 +16,7 @@
#ifndef __WEBSOCKET_SERVER_H_
#define __WEBSOCKET_SERVER_H_
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <mutex>
#include <atomic>
......@@ -71,7 +71,7 @@ public:
void Shutdown();
void RegisterCallback(const std::string &path, std::shared_ptr<StreamingServeInterface> callback);
url::URLDatum GetWebsocketUrl();
std::map<struct lws *, session_data> &GetWsisData();
std::unordered_map<struct lws *, session_data> &GetWsisData();
void SetLwsSendedFlag(struct lws *wsi, bool sended);
void LockAllWsSession();
void UnlockAllWsSession();
......@@ -104,7 +104,7 @@ private:
{ NULL, NULL, 0, 0 }
};
RouteCallbackRegister m_handler;
static std::map<struct lws *, session_data> m_wsis;
static std::unordered_map<struct lws *, session_data> m_wsis;
url::URLDatum m_url;
int m_listenPort;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册