LCOV - code coverage report
Current view: top level - base_comm/resources/endpoints/server_socket - server_socket_mgr.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #ifndef SERVER_SOCKET_MGR_H
      12              : #define SERVER_SOCKET_MGR_H
      13              : 
      14              : #include <mutex>
      15              : #include <memory>
      16              : 
      17              : #include "hccl/hccl_res.h"
      18              : #include "ip_address.h"
      19              : #include "../../../../../../legacy/ascend950/unified_platform/resource/socket/socket.h"
      20              : 
      21              : namespace hcomm {
      22              : 
      23              : class ServerSocketMgr {
      24              : public:
      25              :     static HcclResult ListenStart(const uint32_t devPhyId, const CommAddr& commAddr, const Hccl::NicType nicType);
      26              :     static void DeInit(u32 devPhyId);
      27              : 
      28              : private:
      29              :     static ServerSocketMgr& GetInstance(const uint32_t devicePhyId);
      30              :     HcclResult ListenStart_(const CommAddr& commAddr, const Hccl::NicType nicType);
      31              : 
      32              : private:
      33           66 :     ServerSocketMgr() = default;
      34           66 :     ~ServerSocketMgr() = default;
      35              :     ServerSocketMgr(const ServerSocketMgr& that) = delete;
      36              :     ServerSocketMgr& operator=(const ServerSocketMgr& that) = delete;
      37              : 
      38              :     uint32_t devPhyId_{0};
      39              :     std::mutex innerMutex_{};
      40              :     std::unordered_map<Hccl::IpAddress, std::unique_ptr<Hccl::Socket>> deviceServerSocketMap_{};
      41              :     std::unordered_map<Hccl::IpAddress, std::unique_ptr<Hccl::Socket>> hostServerSocketMap_{};
      42              : };
      43              : 
      44              : } // namespace hcomm
      45              : 
      46              : #endif // SERVER_SOCKET_MGR_H
        

Generated by: LCOV version 2.0-1