From 438881f16f8f67de06cc03eb5cc86c1e82ab4dc0 Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Sun, 25 Jan 2009 13:10:27 +0100 Subject: Improve the torrent stop and btpd shutdown sequences. Torrents are now considered stopped and may be restarted even if the stop event haven't been sent the trackers yet. The same holds for the del and add commands. A btpd process in shutdown mode that only have stopped torrents, but is still sending the stop event to trackers, will release resources that would block a new btpd to start. It will the silently exit when it's finished with the trackers. This also makes the timeout parameter for shutdown unnecessary. --- cli/kill.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'cli') diff --git a/cli/kill.c b/cli/kill.c index 9ae57f1..1d727bb 100644 --- a/cli/kill.c +++ b/cli/kill.c @@ -6,12 +6,7 @@ usage_kill(void) printf( "Shutdown btpd.\n" "\n" - "Usage: kill [seconds]\n" - "\n" - "Arguments:\n" - "seconds\n" - "\tThe number of seconds btpd waits before giving up on unresponsive\n" - "\ttrackers.\n" + "Usage: kill\n" "\n" ); exit(1); @@ -20,18 +15,12 @@ usage_kill(void) void cmd_kill(int argc, char **argv) { - int seconds = -1; enum ipc_err code; - char *endptr; - if (argc == 2) { - seconds = strtol(argv[1], &endptr, 10); - if (strlen(argv[1]) > endptr - argv[1] || seconds < 0) - usage_kill(); - } else if (argc > 2) + if (argc > 1) usage_kill(); btpd_connect(); - if ((code = btpd_die(ipc, seconds)) != 0) + if ((code = btpd_die(ipc)) != 0) diemsg("command failed (%s).\n", ipc_strerror(code)); } -- cgit 1.4.1