summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2009-01-25 13:10:27 +0100
committerRichard Nyberg <rnyberg@murmeldjur.se>2009-01-26 22:15:10 +0100
commit438881f16f8f67de06cc03eb5cc86c1e82ab4dc0 (patch)
tree585c7d9cf0269394aea8ab180d69d0120e5ec839 /misc
parent50b69abbcdbd5d670d987a9affba41dff57c9525 (diff)
downloadbtpd-438881f16f8f67de06cc03eb5cc86c1e82ab4dc0.tar.gz
btpd-438881f16f8f67de06cc03eb5cc86c1e82ab4dc0.zip
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.
Diffstat (limited to 'misc')
-rw-r--r--misc/btpd_if.c7
-rw-r--r--misc/btpd_if.h2
2 files changed, 3 insertions, 6 deletions
diff --git a/misc/btpd_if.c b/misc/btpd_if.c
index f01cab9..a62daba 100644
--- a/misc/btpd_if.c
+++ b/misc/btpd_if.c
@@ -155,13 +155,10 @@ ipc_buf_req_code(struct ipc *ipc, struct iobuf *iob)
 }
 
 enum ipc_err
-btpd_die(struct ipc *ipc, int seconds)
+btpd_die(struct ipc *ipc)
 {
     struct iobuf iob = iobuf_init(16);
-    if (seconds >= 0)
-        iobuf_print(&iob, "l3:diei%dee", seconds);
-    else
-        iobuf_swrite(&iob, "l3:diee");
+    iobuf_swrite(&iob, "l3:diee");
     return ipc_buf_req_code(ipc, &iob);
 }
 
diff --git a/misc/btpd_if.h b/misc/btpd_if.h
index 0879bd4..526e5c3 100644
--- a/misc/btpd_if.h
+++ b/misc/btpd_if.h
@@ -80,7 +80,7 @@ enum ipc_err btpd_del(struct ipc *ipc, struct ipc_torrent *tp);
 enum ipc_err btpd_start(struct ipc *ipc, struct ipc_torrent *tp);
 enum ipc_err btpd_stop(struct ipc *ipc, struct ipc_torrent *tp);
 enum ipc_err btpd_stop_all(struct ipc *ipc);
-enum ipc_err btpd_die(struct ipc *ipc, int seconds);
+enum ipc_err btpd_die(struct ipc *ipc);
 enum ipc_err btpd_get(struct ipc *ipc, enum ipc_dval *keys, size_t nkeys,
     tget_cb_t cb, void *arg);
 enum ipc_err btpd_tget(struct ipc *ipc, struct ipc_torrent *tps, size_t ntps,