aboutsummaryrefslogtreecommitdiff
path: root/programs/tsctp.c
diff options
context:
space:
mode:
authorFelix Weinrank <weinrank@fh-muenster.de>2017-07-16 16:47:18 +0200
committerFelix Weinrank <weinrank@fh-muenster.de>2017-07-16 16:47:18 +0200
commit139c460c50ba38e1420328d14052f0531c9a0d9f (patch)
treefb16feaf8f3208e46144e3a339c6e9c7d457fe6e /programs/tsctp.c
parent0d2b823adb9908e2cc918ea4cafcdc9fca75bd07 (diff)
downloadusrsctp-139c460c50ba38e1420328d14052f0531c9a0d9f.tar.gz
Fix compiler warnings for more strict compiler flags
Diffstat (limited to 'programs/tsctp.c')
-rw-r--r--programs/tsctp.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/programs/tsctp.c b/programs/tsctp.c
index 903c075f..a10a771f 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;