Commit cb69ca10 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Revise last revision; allow -t (timeout) option to in normal and UDP

mode.
parent f727cc8e
...@@ -43,7 +43,7 @@ char *usagestr = ...@@ -43,7 +43,7 @@ char *usagestr =
" -v versnum Specify a version number for tmcd\n" " -v versnum Specify a version number for tmcd\n"
" -n vnodeid Specify the vnodeid\n" " -n vnodeid Specify the vnodeid\n"
" -u Use UDP instead of TCP\n" " -u Use UDP instead of TCP\n"
" -t timeout Timeout waiting for a reply from master (UDP ONLY).\n" " -t timeout Timeout waiting for the controller.\n"
"\n"; "\n";
void void
...@@ -65,8 +65,8 @@ main(int argc, char **argv) ...@@ -65,8 +65,8 @@ main(int argc, char **argv)
char *bossnode = DEFAULT_BOSSNODE; char *bossnode = DEFAULT_BOSSNODE;
int version = CURRENT_VERSION; int version = CURRENT_VERSION;
char *vnodeid = NULL; char *vnodeid = NULL;
#ifdef UDP
int waitfor = 0; int waitfor = 0;
#ifdef UDP
int useudp = 0; int useudp = 0;
#endif #endif
...@@ -86,10 +86,10 @@ main(int argc, char **argv) ...@@ -86,10 +86,10 @@ main(int argc, char **argv)
case 'v': case 'v':
version = atoi(optarg); version = atoi(optarg);
break; break;
#ifdef UDP
case 't': case 't':
waitfor = atoi(optarg); waitfor = atoi(optarg);
break; break;
#ifdef UDP
case 'u': case 'u':
useudp = 1; useudp = 1;
break; break;
...@@ -134,6 +134,10 @@ main(int argc, char **argv) ...@@ -134,6 +134,10 @@ main(int argc, char **argv)
exit(1); exit(1);
} }
if (waitfor) {
alarm(waitfor);
}
/* /*
* Handle built-in "bossinfo" command * Handle built-in "bossinfo" command
*/ */
...@@ -346,9 +350,6 @@ doudp(int argc, char **argv, ...@@ -346,9 +350,6 @@ doudp(int argc, char **argv,
exit(1); exit(1);
} }
if (waitfor) {
alarm(waitfor);
}
cc = recvfrom(sock, buf, sizeof(buf), 0, cc = recvfrom(sock, buf, sizeof(buf), 0,
(struct sockaddr *)&client, &length); (struct sockaddr *)&client, &length);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment