instrumentation/hrktorrent: add basic functionality for retrieving peer-specific...
authorP2P-Next <p2p-next@cs.pub.ro>
Wed, 11 Aug 2010 17:15:56 +0000 (20:15 +0300)
committerP2P-Next <p2p-next@cs.pub.ro>
Wed, 11 Aug 2010 17:15:56 +0000 (20:15 +0300)
instrumentation/hrktorrent/core.cpp

index 623a979..2295407 100644 (file)
@@ -78,6 +78,9 @@ CCore::StatusLoop(void* data)
        int eta = 0, columns = 0, loopcount = 0;\r
        bool stdout_is_tty = false;\r
 \r
+       /* peer_info array for storing peer-specific information */\r
+       std::vector<libtorrent::peer_info> peers;\r
+\r
        stdout_is_tty = (isatty(STDOUT_FILENO) == 1);\r
        if (stdout_is_tty) {\r
                if(ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0) {\r
@@ -98,6 +101,7 @@ CCore::StatusLoop(void* data)
                        Core->VerbosePrint("Core", "Reannouncing!\n");\r
                }\r
 \r
+               /* build standard status message */\r
                sstatus = s->status();\r
                tstatus = t->status();\r
                eta = GetETA(tstatus.total_done, tstatus.total_wanted, (libtorrent::size_type)sstatus.download_rate);\r
@@ -138,6 +142,9 @@ CCore::StatusLoop(void* data)
                PrintStatusStream(output, columns, stdout_is_tty);\r
                output.str("");\r
 \r
+               /* build peer status message */\r
+               t->get_peer_info(peers);\r
+\r
                sleep(1);\r
                loopcount++;\r
        }\r