testing swarming
authorvictor <victor@e16421f0-f15b-0410-abcd-98678b794739>
Fri, 6 Nov 2009 17:06:46 +0000 (17:06 +0000)
committervictor <victor@e16421f0-f15b-0410-abcd-98678b794739>
Fri, 6 Nov 2009 17:06:46 +0000 (17:06 +0000)
git-svn-id: https://ttuki.vtt.fi/svn/p2p-next/TUD/p2tp/trunk@506 e16421f0-f15b-0410-abcd-98678b794739

BUGS
exec/leecher.cpp
tests/pex_test.sh [new file with mode: 0755]

diff --git a/BUGS b/BUGS
index 8fb861c..610a7fa 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -14,3 +14,5 @@
     * minimize the number of template instantiations
     * Channel thinks how much it HINTs a second,
       picker thinks which HINTs are snubbed
+    * dead Channels are not killed => cannot open a new one
+        (have a channel already)
index cee17e4..8734d61 100644 (file)
@@ -15,7 +15,7 @@ using namespace p2tp;
 /** P2TP downloader. Params: root hash, filename, tracker ip/port, own ip/port */
 int main (int argn, char** args) {
     
-    srand(time(NULL));
+    srand(Datagram::Time());
     FileTransfer::instance = rand();
     
     if (argn<4) {
diff --git a/tests/pex_test.sh b/tests/pex_test.sh
new file mode 100755 (executable)
index 0000000..89767ad
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+EXEC=build/Debug/
+PEERCOUNT=2
+STORE=_pextest 
+TOKILL=
+rm -rf $STORE
+mkdir $STORE
+
+#$EXEC/seeder doc/sofi.jpg 7001
+
+for i in `seq 1 $PEERCOUNT`; do
+    ( $EXEC/leecher 282a863d5567695161721686a59f0c667250a35d \
+        $STORE/sofi$i.jpg 7001 710$i > $STORE/leecher$i.log ) &
+    TOKILL="$TOKILL $!"
+    sleep 1;
+done
+
+sleep 10
+
+for p in $TOKILL; do
+    kill -9 $p
+done
+
+for i in `seq 1 $PEERCOUNT`; do
+    cat $STORE/leecher$i.log | grep sent | awk '{print $5}' | \
+        sort | uniq -c > $STORE/peers$i.txt
+    peers=`wc -l < $STORE/peers$i.txt`
+    if [ $peers -ne $PEERCOUNT ]; then
+        echo Peer $i has $peers peers
+    fi
+done