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

Function ping_main_sync

lib_protocol/samples/ping/main.c:100–130  ·  view source on GitHub ↗

���߳� PING ������ַ�ĺ������ */

Source from the content-addressed store, hash-verified

98
99/* ���߳� PING ������ַ�ĺ������ */
100static void ping_main_sync(const char *dest, int npkt)
101{
102 ACL_DNS_DB* dns_db;
103 const char* ip;
104
105 /* ���� ICMP ���� */
106 __chat = icmp_chat_create(NULL, 1);
107
108 /* ������������ IP ��ַ */
109 dns_db = acl_gethostbyname(dest, NULL);
110 if (dns_db == NULL) {
111 acl_msg_warn("Can't find domain %s", dest);
112 return;
113 }
114
115 ip = acl_netdb_index_ip(dns_db, 0);
116 if (ip == NULL || *ip == 0)
117 acl_msg_fatal("ip invalid");
118
119 /* ��ʼ PING һ�� IP ��ַ */
120 if (strcmp(dest, ip) == 0)
121 icmp_ping_one(__chat, NULL, ip, npkt, __delay, 1);
122 else
123 icmp_ping_one(__chat, dest, ip, npkt, __delay, 1);
124
125 /* �ͷ� DNS ��ѯ��� */
126 acl_netdb_free(dns_db);
127
128 /* ��ʾ PING ���С�� */
129 display_res();
130}
131
132/* PING �߳���� */
133static int __npkt = 10;

Callers 1

mainFunction · 0.85

Calls 8

icmp_chat_createFunction · 0.85
acl_gethostbynameFunction · 0.85
acl_msg_warnFunction · 0.85
acl_netdb_index_ipFunction · 0.85
acl_msg_fatalFunction · 0.85
icmp_ping_oneFunction · 0.85
acl_netdb_freeFunction · 0.85
display_resFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…