MCPcopy Create free account
hub / github.com/acl-dev/acl / check_addr

Function check_addr

lib_acl_cpp/independent/connpool/src/connect_manager.cpp:33–59  ·  view source on GitHub ↗

����һ����������ַ����ʽ��IP:PORT[:MAX_CONN] ����ֵ < 0 ��ʾ�Ƿ��ĵ�ַ

Source from the content-addressed store, hash-verified

31// ����һ����������ַ����ʽ��IP:PORT[:MAX_CONN]
32// ����ֵ < 0 ��ʾ�Ƿ��ĵ�ַ
33static int check_addr(const char* addr, std::string& buf, int default_count)
34{
35 buf.clear();
36
37 // ���ݸ�ʽ��IP:PORT[:CONNECT_COUNT]
38 std::vector<std::string> tokens;
39 split3(addr, ":|", tokens);
40 if (tokens.size() < 2)
41 return -1;
42
43 int port = atoi(tokens[1].c_str());
44 if (port <= 0 || port >= 65535)
45 return -1;
46
47 buf = tokens[0].c_str();
48 buf += ":";
49 buf += port;
50
51 int conn_max;
52 if (tokens.size() >= 3)
53 conn_max = atoi(tokens[2].c_str());
54 else
55 conn_max = default_count;
56 if (conn_max <= 0)
57 conn_max = default_count;
58 return conn_max;
59}
60
61bool connect_manager::init(const char* default_addr,
62 const char* addr_list, int count)

Callers 2

initMethod · 0.70
set_service_listMethod · 0.70

Calls 4

split3Function · 0.85
clearMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…