summaryrefslogtreecommitdiff
path: root/sockets.c
diff options
context:
space:
mode:
Diffstat (limited to 'sockets.c')
-rw-r--r--sockets.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/sockets.c b/sockets.c
index 6c1370b..40079c2 100644
--- a/sockets.c
+++ b/sockets.c
@@ -60,22 +60,22 @@ int createclientsocket(char *listenport) {
int listener; // listening socket descriptor
int rv; // return value for getaddrinfo (for error message)
- struct addrinfo hints, *ai, *p;
+ struct addrinfo hints, *ai, *p;
int yes = 1; // for enabling socket options with setsockopt
- // get us a socket and bind it
- memset(&hints, 0, sizeof hints);
- hints.ai_family = AF_UNSPEC;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_PASSIVE;
+ // get us a socket and bind it
+ memset(&hints, 0, sizeof hints);
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_PASSIVE;
- if ((rv = getaddrinfo(NULL, listenport, &hints, &ai)) != 0) {
- fprintf(stderr, "bouncer-client: %s\n", gai_strerror(rv));
- exit(1);
- }
+ if ((rv = getaddrinfo(NULL, listenport, &hints, &ai)) != 0) {
+ fprintf(stderr, "bouncer-client: %s\n", gai_strerror(rv));
+ exit(1);
+ }
// Try for IPv6
- for (p = ai; p != NULL; p = p->ai_next) {
+ for (p = ai; p != NULL; p = p->ai_next) {
if (p->ai_family == AF_INET6) {
listener = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
if (listener != -1) {
@@ -110,13 +110,13 @@ int createclientsocket(char *listenport) {
exit(1);
}
- // if we got here, it means we didn't get bound
- if (p == NULL) {
- fprintf(stderr, "bouncer-client: failed to bind\n");
- exit(2);
- }
+ // if we got here, it means we didn't get bound
+ if (p == NULL) {
+ fprintf(stderr, "bouncer-client: failed to bind\n");
+ exit(2);
+ }
- freeaddrinfo(ai); // all done with this
+ freeaddrinfo(ai); // all done with this
// listen
if (listen(listener, BACKLOG) == -1) {