mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
pipe: fix timeout
This commit is contained in:
parent
2e8f01b7fc
commit
fe2abf760d
1 changed files with 4 additions and 6 deletions
10
src/pipe.c
10
src/pipe.c
|
@ -95,7 +95,7 @@ static void usage()
|
||||||
printf(" -x swap read / write endpoints\n");
|
printf(" -x swap read / write endpoints\n");
|
||||||
printf(" -s only read data from stdin and send it to node\n");
|
printf(" -s only read data from stdin and send it to node\n");
|
||||||
printf(" -r only read data from node and write it to stdout\n");
|
printf(" -r only read data from node and write it to stdout\n");
|
||||||
printf(". -t NUM terminate after NUM seconds\n");
|
printf(" -t NUM terminate after NUM seconds\n");
|
||||||
printf(" -L NUM terminate after NUM samples sent\n");
|
printf(" -L NUM terminate after NUM samples sent\n");
|
||||||
printf(" -l NUM terminate after NUM samples received\n\n");
|
printf(" -l NUM terminate after NUM samples received\n\n");
|
||||||
|
|
||||||
|
@ -206,10 +206,8 @@ leave: info("Reached receive limit. Terminating...");
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int ret, level = V;
|
int ret, level = V, timeout = 0;
|
||||||
|
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
double timeout = 0;
|
|
||||||
|
|
||||||
sendd = recvv = (struct dir) {
|
sendd = recvv = (struct dir) {
|
||||||
.enabled = true,
|
.enabled = true,
|
||||||
|
@ -240,7 +238,7 @@ int main(int argc, char *argv[])
|
||||||
sendd.limit = strtoul(optarg, &endptr, 10);
|
sendd.limit = strtoul(optarg, &endptr, 10);
|
||||||
goto check;
|
goto check;
|
||||||
case 't':
|
case 't':
|
||||||
timeout = strtod(optarg, &endptr);
|
timeout = strtoul(optarg, &endptr, 10);
|
||||||
goto check;
|
goto check;
|
||||||
case 'h':
|
case 'h':
|
||||||
case '?':
|
case '?':
|
||||||
|
@ -305,7 +303,7 @@ check: if (optarg == endptr)
|
||||||
if (sendd.enabled)
|
if (sendd.enabled)
|
||||||
pthread_create(&sendd.thread, NULL, send_loop, NULL);
|
pthread_create(&sendd.thread, NULL, send_loop, NULL);
|
||||||
|
|
||||||
ualarm(timeout * 1e6, 0);
|
alarm(timeout);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
pause();
|
pause();
|
||||||
|
|
Loading…
Add table
Reference in a new issue