Removed reference to DEBUG_* macros in examples and libzt proper
This commit is contained in:
@@ -84,41 +84,41 @@ int main(int argc, char **argv)
|
||||
|
||||
// --- BEGIN EXAMPLE CODE
|
||||
|
||||
DEBUG_TEST("Waiting for libzt to come online...\n");
|
||||
printf("Waiting for libzt to come online...\n");
|
||||
nwid = generate_adhoc_nwid_from_port(bind_port);
|
||||
printf("nwid=%llx\n", (unsigned long long)nwid);
|
||||
zts_startjoin(path.c_str(), nwid);
|
||||
uint64_t nodeId = zts_get_node_id();
|
||||
DEBUG_TEST("I am %llx", (unsigned long long)nodeId);
|
||||
printf("I am %llx\n", (unsigned long long)nodeId);
|
||||
|
||||
if ((sockfd = zts_socket(AF_INET6, SOCK_STREAM, 0)) < 0) {
|
||||
DEBUG_ERROR("error creating ZeroTier socket");
|
||||
printf("error creating ZeroTier socket\n");
|
||||
}
|
||||
|
||||
if ((err = zts_bind(sockfd, (struct sockaddr *)&in6, sizeof(struct sockaddr_in6)) < 0)) {
|
||||
DEBUG_ERROR("error binding to interface (%d)", err);
|
||||
printf("error binding to interface (%d)\n", err);
|
||||
}
|
||||
|
||||
if ((err = zts_listen(sockfd, 100)) < 0) {
|
||||
DEBUG_ERROR("error placing socket in LISTENING state (%d)", err);
|
||||
printf("error placing socket in LISTENING state (%d)\n", err);
|
||||
}
|
||||
|
||||
socklen_t client_addrlen = sizeof(sockaddr_in6);
|
||||
if ((accfd = zts_accept(sockfd, (struct sockaddr *)&acc_in6, &client_addrlen)) < 0) {
|
||||
DEBUG_ERROR("error accepting connection (%d)", err);
|
||||
printf("error accepting connection (%d)\n", err);
|
||||
}
|
||||
|
||||
socklen_t peer_addrlen = sizeof(struct sockaddr_storage);
|
||||
zts_getpeername(accfd, (struct sockaddr*)&acc_in6, &peer_addrlen);
|
||||
//DEBUG_INFO("accepted connection from %s : %d", inet_ntoa(acc_in6.sin6_addr), ntohs(acc_in6.sin6_port));
|
||||
//printf("accepted connection from %s : %d", inet_ntoa(acc_in6.sin6_addr), ntohs(acc_in6.sin6_port));
|
||||
|
||||
DEBUG_TEST("reading from client...");
|
||||
printf("reading from client...\n");
|
||||
r = zts_read(accfd, rbuf, sizeof rbuf);
|
||||
|
||||
DEBUG_TEST("sending to client...");
|
||||
printf("sending to client...\n");
|
||||
w = zts_write(accfd, rbuf, strlen(rbuf));
|
||||
|
||||
DEBUG_TEST("Received : %s", rbuf);
|
||||
printf("Received : %s\n", rbuf);
|
||||
|
||||
err = zts_close(sockfd);
|
||||
err = zts_close(accfd);
|
||||
|
||||
Reference in New Issue
Block a user