summaryrefslogtreecommitdiff
path: root/programs
diff options
context:
space:
mode:
authorFelix Weinrank <weinrank@fh-muenster.de>2017-07-16 14:47:18 (GMT)
committerFelix Weinrank <weinrank@fh-muenster.de>2017-07-16 14:47:18 (GMT)
commit139c460c50ba38e1420328d14052f0531c9a0d9f (patch)
treefb16feaf8f3208e46144e3a339c6e9c7d457fe6e /programs
parent0d2b823adb9908e2cc918ea4cafcdc9fca75bd07 (diff)
downloadusrsctp-139c460c50ba38e1420328d14052f0531c9a0d9f.tar.gz
usrsctp-139c460c50ba38e1420328d14052f0531c9a0d9f.tar.xz
Fix compiler warnings for more strict compiler flags
Diffstat (limited to 'programs')
-rw-r--r--programs/daytime_server.c2
-rw-r--r--programs/ekr_server.c2
-rw-r--r--programs/tsctp.c26
3 files changed, 16 insertions, 14 deletions
diff --git a/programs/daytime_server.c b/programs/daytime_server.c
index 18a0fcb..4fb7e11 100644
--- a/programs/daytime_server.c
+++ b/programs/daytime_server.c
@@ -125,6 +125,7 @@ main(int argc, char *argv[])
(socklen_t)sizeof(struct sctp_sndinfo), SCTP_SENDV_SNDINFO, 0);
usrsctp_close(conn_sock);
}
+#if 0
usrsctp_close(sock);
while (usrsctp_finish() != 0) {
#ifdef _WIN32
@@ -133,5 +134,6 @@ main(int argc, char *argv[])
sleep(1);
#endif
}
+#endif
return (0);
}
diff --git a/programs/ekr_server.c b/programs/ekr_server.c
index 02f02b1..0056e64 100644
--- a/programs/ekr_server.c
+++ b/programs/ekr_server.c
@@ -271,6 +271,7 @@ main(int argc, char *argv[])
perror("usrsctp_accept");
}
}
+#if 0 // unreachable codepath
usrsctp_close(s);
usrsctp_deregister_address((void *)&fd);
while (usrsctp_finish() != 0) {
@@ -294,5 +295,6 @@ main(int argc, char *argv[])
perror("close");
}
#endif
+#endif
return (0);
}
diff --git a/programs/tsctp.c b/programs/tsctp.c
index 903c075..a10a771 100644
--- a/programs/tsctp.c
+++ b/programs/tsctp.c
@@ -137,7 +137,6 @@ static void *
handle_connection(void *arg)
{
ssize_t n;
- unsigned long long sum = 0, first_length = 0;
char *buf;
#ifdef _WIN32
HANDLE tid;
@@ -145,9 +144,8 @@ handle_connection(void *arg)
pthread_t tid;
#endif
struct socket *conn_sock;
- struct timeval start_time, now, diff_time;
+ struct timeval time_start, time_now, time_diff;
double seconds;
- unsigned long messages = 0;
unsigned long recv_calls = 0;
unsigned long notifications = 0;
int flags;
@@ -176,7 +174,7 @@ handle_connection(void *arg)
n = usrsctp_recvv(conn_sock, buf, BUFFERSIZE, (struct sockaddr *) &addr, &len, (void *)&rn,
&infolen, &infotype, &flags);
- gettimeofday(&start_time, NULL);
+ gettimeofday(&time_start, NULL);
while (n > 0) {
recv_calls++;
if (flags & MSG_NOTIFICATION) {
@@ -210,10 +208,10 @@ handle_connection(void *arg)
}
if (n < 0)
perror("sctp_recvv");
- gettimeofday(&now, NULL);
- timersub(&now, &start_time, &diff_time);
- seconds = diff_time.tv_sec + (double)diff_time.tv_usec/1000000.0;
- printf("%llu, %lu, %lu, %lu, %llu, %f, %f\n",
+ gettimeofday(&time_now, NULL);
+ timersub(&time_now, &time_start, &time_diff);
+ seconds = time_diff.tv_sec + (double)time_diff.tv_usec/1000000.0;
+ printf("%d, %lu, %lu, %lu, %llu, %f, %f\n",
first_length, messages, recv_calls, notifications, sum, seconds, (double)first_length * (double)messages / seconds);
fflush(stdout);
usrsctp_close(conn_sock);
@@ -353,7 +351,7 @@ int main(int argc, char **argv)
#endif
socklen_t addr_len;
struct sockaddr_in local_addr;
- struct timeval start_time, now, diff_time;
+ struct timeval time_start, time_now, time_diff;
int client;
uint16_t local_port, remote_port, port, local_udp_port, remote_udp_port;
int rcvbufsize=0, sndbufsize=0, myrcvbufsize, mysndbufsize;
@@ -675,7 +673,7 @@ int main(int argc, char **argv)
printf("Connection accepted from %s:%d\n", inet_ntop(AF_INET, &(remote_addr.sin_addr), addrbuf, INET_ADDRSTRLEN), ntohs(remote_addr.sin_port));
}
}
- usrsctp_close(psock);
+ //usrsctp_close(psock); // unreachable
} else {
memset(&encaps, 0, sizeof(struct sctp_udpencaps));
encaps.sue_address.ss_family = AF_INET;
@@ -732,7 +730,7 @@ int main(int argc, char **argv)
exit(1);
}
- gettimeofday(&start_time, NULL);
+ gettimeofday(&time_start, NULL);
done = 0;
@@ -807,9 +805,9 @@ int main(int argc, char **argv)
}
usrsctp_close(psock);
- gettimeofday(&now, NULL);
- timersub(&now, &start_time, &diff_time);
- seconds = diff_time.tv_sec + (double)diff_time.tv_usec/1000000;
+ gettimeofday(&time_now, NULL);
+ timersub(&time_now, &time_start, &time_diff);
+ seconds = time_diff.tv_sec + (double)time_diff.tv_usec/1000000;
printf("%s of %ld messages of length %u took %f seconds.\n",
"Sending", messages, length, seconds);
throughput = (double)messages * (double)length / seconds;