about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--btpd/btpd.c11
-rw-r--r--btpd/btpd.h3
2 files changed, 13 insertions, 1 deletions
diff --git a/btpd/btpd.c b/btpd/btpd.c
index 3a4a346..c73d5bd 100644
--- a/btpd/btpd.c
+++ b/btpd/btpd.c
@@ -123,6 +123,15 @@ btpd_get_torrent(const uint8_t *hash)
     return tp;
 }
 
+struct torrent *
+btpd_get_torrent_num(unsigned num)
+{
+    struct torrent *tp = BTPDQ_FIRST(&m_torrents);
+    while (tp != NULL && tp->num != num)
+        tp = BTPDQ_NEXT(tp, entry);
+    return tp;
+}
+
 const uint8_t *
 btpd_get_peer_id(void)
 {
@@ -253,9 +262,11 @@ btpd_init(void)
 
     load_library();
 
+#if 0
     struct torrent *tp;
     BTPDQ_FOREACH(tp, &m_torrents, entry)
         torrent_activate(tp);
+#endif
 
     signal(SIGPIPE, SIG_IGN);
 
diff --git a/btpd/btpd.h b/btpd/btpd.h
index 6feba67..1700248 100644
--- a/btpd/btpd.h
+++ b/btpd/btpd.h
@@ -50,7 +50,8 @@ void *btpd_calloc(size_t nmemb, size_t size);
 
 void btpd_shutdown(struct timeval *grace_tv);
 
-struct torrent * btpd_get_torrent(const uint8_t *hash);
+struct torrent *btpd_get_torrent(const uint8_t *hash);
+struct torrent *btpd_get_torrent_num(unsigned num);
 const struct torrent_tq *btpd_get_torrents(void);
 void btpd_add_torrent(struct torrent *tp);
 void btpd_del_torrent(struct torrent *tp);