summaryrefslogtreecommitdiff
path: root/sockets.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-05-27 23:01:11 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-05-27 23:01:11 +0100
commit31ce10b31198128de4983667820319a193adb976 (patch)
tree99ff7bc13815f25c13a8d994b7dc28d302e72225 /sockets.c
parent4b2cd5c4c349ea3e5683a6b2beb42c518d3ccef3 (diff)
Make debug output optional and disabled by default.
Diffstat (limited to 'sockets.c')
-rw-r--r--sockets.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sockets.c b/sockets.c
index 562e5c0..7581779 100644
--- a/sockets.c
+++ b/sockets.c
@@ -22,7 +22,7 @@ int createserversocket(char *host, char *port) {
if ((rv = getaddrinfo(host, port, &hints, &servinfo)) != 0) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
- return 1;
+ return 1; // TODO - Should this perhaps return 0 or exit?
}
// loop through all the results and connect to the first we can
@@ -43,11 +43,11 @@ int createserversocket(char *host, char *port) {
if (p == NULL) {
fprintf(stderr, "bouncer-server: failed to connect\n");
- return 2;
+ return 2; // TODO - Should this perhaps return 0 or exit?
}
inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), s, sizeof s);
- printf("bouncer-server: connecting to %s\n", s);
+ debugprint("bouncer-server: connecting to %s\n", s);
freeaddrinfo(servinfo); // all done with this structure
@@ -78,7 +78,7 @@ int createclientsocket(char *listenport) {
listener = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
if (listener != -1) {
// success, got IPv6!
- printf("success, got IPv6! ai_family: %d\n", p->ai_family);
+ debugprint("success, got IPv6! ai_family: %d\n", p->ai_family);
break;
}
}
@@ -91,7 +91,7 @@ int createclientsocket(char *listenport) {
listener = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
if (listener != -1) {
// moderate success, got IPv4!
- printf("moderate success, got IPv4! ai_family: %d\n", p->ai_family);
+ debugprint("moderate success, got IPv4! ai_family: %d\n", p->ai_family);
break;
}
}