MCPcopy Create free account
hub / github.com/OpenArkStudio/ARK / CreateClientService

Method CreateClientService

src/plugin/net/src/AFCNetServiceManagerModule.cpp:282–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282bool AFCNetServiceManagerModule::CreateClientService(const AFBusAddr& bus_addr, const std::string& ip, uint16_t port)
283{
284 ARK_APP_TYPE app_type = ARK_APP_TYPE(bus_addr.app_type);
285 auto pClient = client_services_.find_value(app_type);
286 if (pClient == nullptr)
287 {
288 pClient = std::make_shared<AFCNetClientService>(GetPluginManager());
289 client_services_.insert(app_type, pClient);
290 }
291
292 AFEndpoint target_ep;
293 target_ep.SetIsV6(false);
294 target_ep.SetProtocol(proto_type::tcp);
295 target_ep.SetIP(ip);
296 target_ep.SetPort(port);
297 bool ret = pClient->StartClient(AFHeadLength::SS_HEAD_LENGTH, bus_addr.bus_id, target_ep);
298 if (!ret)
299 {
300 ARK_LOG_ERROR("start net client failed, self_bus_id={} target_url={}", m_pBusModule->GetSelfBusName(),
301 target_ep.ToString());
302 return ret;
303 }
304
305 ARK_LOG_INFO("start net client successful, self_bus_id={} target_url={}", m_pBusModule->GetSelfBusName(),
306 target_ep.ToString());
307 return true;
308}
309
310bool AFCNetServiceManagerModule::CheckConnectedTargetServer(const AFBusAddr& bus_addr)
311{

Callers

nothing calls this directly

Calls 10

ARK_APP_TYPEEnum · 0.85
SetIsV6Method · 0.80
SetProtocolMethod · 0.80
SetPortMethod · 0.80
GetSelfBusNameMethod · 0.80
find_valueMethod · 0.45
insertMethod · 0.45
SetIPMethod · 0.45
StartClientMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected