aboutsummaryrefslogtreecommitdiff
path: root/src/net.c
diff options
context:
space:
mode:
authorsethdelliott <devnull@localhost>2010-07-20 22:27:50 +0000
committersethdelliott <devnull@localhost>2010-07-20 22:27:50 +0000
commitb60a49dd37350c0a7d05b9ed18347f687c2819ce (patch)
tree36f610bb01912f3f576636c751a8c009f84f3732 /src/net.c
parent3118b42010e9b534f5e32ec7e9dcc7ba1cd7593b (diff)
downloadiperf3-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.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/net.c b/src/net.c
index b44f30a..3e60b81 100644
--- a/src/net.c
+++ b/src/net.c
@@ -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)
{