about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2006-10-15 09:04:49 +0000
committerRichard Nyberg <rnyberg@murmeldjur.se>2006-10-15 09:04:49 +0000
commit110b1d7e2241fbc2f013f8059c3b83756ca5bc6c (patch)
treee0bb6ffcee775513c2db9a52bbf2b632a7173180
parent29495ab53bebbdfde86dc9488acfe236d3669e57 (diff)
downloadbtpd-110b1d7e2241fbc2f013f8059c3b83756ca5bc6c.tar.gz
btpd-110b1d7e2241fbc2f013f8059c3b83756ca5bc6c.zip
Always update the tlib info when a torrent is stopped. Some code shuffle.
-rw-r--r--btpd/torrent.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/btpd/torrent.c b/btpd/torrent.c
index 427e147..9d9fa8d 100644
--- a/btpd/torrent.c
+++ b/btpd/torrent.c
@@ -156,12 +156,14 @@ torrent_kill(struct torrent *tp)
     assert(!(tr_active(tp) || net_active(tp) || cm_active(tp)));
     m_ntorrents--;
     BTPDQ_REMOVE(&m_torrents, tp, entry);
-    tr_kill(tp);
-    net_kill(tp);
-    cm_kill(tp);
+    if (!tp->delete)
+        tlib_update_info(tp->tl);
     tp->tl->tp = NULL;
     if (tp->delete)
         tlib_del(tp->tl);
+    tr_kill(tp);
+    net_kill(tp);
+    cm_kill(tp);
     mi_free_files(tp->nfiles, tp->files);
     free(tp);
     if (m_ntorrents == 0)
@@ -174,7 +176,6 @@ torrent_stop(struct torrent *tp)
     int tra, cma;
     switch (tp->state) {
     case T_ACTIVE:
-        tlib_update_info(tp->tl);
     case T_STARTING:
         tp->state = T_STOPPING;
         if (net_active(tp))