diff options
author | sethdelliott <devnull@localhost> | 2010-07-20 22:27:50 +0000 |
---|---|---|
committer | sethdelliott <devnull@localhost> | 2010-07-20 22:27:50 +0000 |
commit | b60a49dd37350c0a7d05b9ed18347f687c2819ce (patch) | |
tree | 36f610bb01912f3f576636c751a8c009f84f3732 /src/net.c | |
parent | 3118b42010e9b534f5e32ec7e9dcc7ba1cd7593b (diff) | |
download | iperf3-b60a49dd37350c0a7d05b9ed18347f687c2819ce.tar.gz |
All error handling is now handled by iperf_error. Also cleaned up some code
Diffstat (limited to 'src/net.c')
-rw-r--r-- | src/net.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -29,13 +29,11 @@ netdial(int proto, char *client, int port) /* XXX: This is not working for non-fully qualified host names use getaddrinfo() instead? */ if ((hent = gethostbyname(client)) == 0) { - // perror("gethostbyname"); return (-1); } s = socket(AF_INET, proto, 0); if (s < 0) { - // perror("socket"); return (-1); } @@ -45,7 +43,6 @@ netdial(int proto, char *client, int port) sa.sin_family = AF_INET; if (connect(s, (struct sockaddr *) & sa, sizeof sa) < 0 && errno != EINPROGRESS) { - // perror("netdial: connect error"); return (-1); } @@ -53,7 +50,6 @@ netdial(int proto, char *client, int port) // XXX: Is there a reason to call getpeername() if none of the return values are used? if (getpeername(s, (struct sockaddr *) & sa, &sn) < 0) { - // perror("getpeername error"); return (-1); } @@ -73,7 +69,6 @@ netannounce(int proto, char *local, int port) s = socket(AF_INET, proto, 0); if (s < 0) { - perror("socket"); return (-1); } int opt = 1; @@ -84,12 +79,14 @@ netannounce(int proto, char *local, int port) if (bind(s, (struct sockaddr *) & sa, sizeof(struct sockaddr_in)) < 0) { close(s); - perror("bind"); return (-1); } - if (proto == SOCK_STREAM) - listen(s, 5); + if (proto == SOCK_STREAM) { + if (listen(s, 5) < 0) { + return (-1); + } + } return s; } @@ -195,6 +192,7 @@ getsock_tcp_mss(int inSock) /*************************************************************/ /* sets TCP_NODELAY and TCP_MAXSEG if requested */ +// XXX: This function is not being used. int set_tcp_options(int sock, int no_delay, int mss) @@ -244,6 +242,7 @@ set_tcp_options(int sock, int no_delay, int mss) /****************************************************************************/ +// XXX: This function is not being used. int setnonblocking(int sock) { |