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

Function check_addr

lib_acl_cpp/src/connpool/connect_manager.cpp:46–74  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

44// ����һ����������ַ����ʽ��IP:PORT[:MAX_CONN]
45// ����ֵ < 0 ��ʾ�Ƿ��ĵ�ַ
46static int check_addr(const char* addr, string& buf, size_t default_count)
47{
48 // ���ݸ�ʽ��IP:PORT[:CONNECT_COUNT]
49 ACL_ARGV* tokens = acl_argv_split(addr, ":|");
50 if (tokens->argc < 2) {
51 logger_error("invalid addr: %s", addr);
52 acl_argv_free(tokens);
53 return -1;
54 }
55
56 int port = atoi(tokens->argv[1]);
57 if (port <= 0 || port >= 65535) {
58 logger_error("invalid addr: %s, port: %d", addr, port);
59 acl_argv_free(tokens);
60 return -1;
61 }
62 buf.format("%s:%d", tokens->argv[0], port);
63 int conn_max;
64 if (tokens->argc >= 3) {
65 conn_max = atoi(tokens->argv[2]);
66 } else {
67 conn_max = (int) default_count;
68 }
69 if (conn_max < 0) {
70 conn_max = (int) default_count;
71 }
72 acl_argv_free(tokens);
73 return conn_max;
74}
75
76void connect_manager::set_retry_inter(int n)
77{

Callers 2

initMethod · 0.70
acl_foreachFunction · 0.70

Calls 3

acl_argv_splitFunction · 0.85
acl_argv_freeFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…