summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2023-01-12 23:15:09 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2023-01-12 23:15:09 +0100
commit3d03649c1f3c572c39eee1a2453bc69c40decfa9 (patch)
tree7760df657a056c0059463c9011ec4c5a5f42b154
parentattempts to fix ping flood and sybil attacks (diff)
downloadtravnik-3d03649c1f3c572c39eee1a2453bc69c40decfa9.tar
travnik-3d03649c1f3c572c39eee1a2453bc69c40decfa9.tar.gz
travnik-3d03649c1f3c572c39eee1a2453bc69c40decfa9.tar.bz2
travnik-3d03649c1f3c572c39eee1a2453bc69c40decfa9.tar.lz
travnik-3d03649c1f3c572c39eee1a2453bc69c40decfa9.tar.xz
travnik-3d03649c1f3c572c39eee1a2453bc69c40decfa9.tar.zst
travnik-3d03649c1f3c572c39eee1a2453bc69c40decfa9.zip
-rw-r--r--README.md9
-rw-r--r--makefile2
-rw-r--r--misc/links.txt1
-rw-r--r--misc/valgrind-2023-01-12.txt1495
-rw-r--r--src/dht.c127
-rw-r--r--src/main.c47
-rw-r--r--www/index.php13
7 files changed, 1642 insertions, 52 deletions
diff --git a/README.md b/README.md
index 39eba7c..514f7b9 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,14 @@
* uses A LOT of bandwidth, implement packet deduplication (fixed?)
# anti sybil measures:
-* detecting sybil with buckets > 32 (done)
+* analysis: geoip for queries, get their localtime and update counter for current 15 minute period in countries time(queries) chart
+* only get_peers when aren't any peers to test
+* periodic counter for packets that resets on periodic call, breaks into debugger if any of the following is larger than 2**14:
+ - received queries
+ - sent queries
+ - received responses
+ - sent responses
+* detecting sybil with buckets > 64 (done)
* disallowing IP addresses to be added into our own bucket that already exist in the routing table (done)
- currently only if IP address is the one that causes the split, this may be suboptimal
* TODO: accept every replied node into the routing table only after pinging it with a random ID, storing in t encrypted first MAXT-1 bytes of the id that it sent with packet that generated a replied(). upon receiving the reply, if the r/id and decrypted t don't match in MAXT-1 bytes, ignore the node (it's a sybil attacker).
diff --git a/makefile b/makefile
index 35826df..a348ba3 100644
--- a/makefile
+++ b/makefile
@@ -1,6 +1,6 @@
DESTDIR=/
CC=cc
-MYCFLAGS=-DHARDCODED_DNS=`(host ipv6.sijanec.eu || echo no_host_program_on_build_host) | tail -n1 | rev | cut -d\ -f1 | rev` -Wall -Wextra -Wformat -pedantic -g -Isrc -Itmp -Itiny-AES-c # -fsanitize=address
+MYCFLAGS=-DHARDCODED_DNS=`(host ipv6.sijanec.eu || echo no_host_program_on_build_host) | tail -n1 | rev | cut -d\ -f1 | rev` -O0 -Wall -Wextra -Wformat -pedantic -g -Isrc -Itmp -Itiny-AES-c # -fsanitize=address
MYLDFLAGS=-lresolv -lmd
default:
diff --git a/misc/links.txt b/misc/links.txt
new file mode 100644
index 0000000..adb898e
--- /dev/null
+++ b/misc/links.txt
@@ -0,0 +1 @@
+https://www.europol-europa.eu/police2peer <= torrent nr. 44a058d498dd1880d82570b7e5b7ea729472f529
diff --git a/misc/valgrind-2023-01-12.txt b/misc/valgrind-2023-01-12.txt
new file mode 100644
index 0000000..56f3e4a
--- /dev/null
+++ b/misc/valgrind-2023-01-12.txt
@@ -0,0 +1,1495 @@
+==3307== Memcheck, a memory error detector
+==3307== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
+==3307== Using Valgrind-3.20.0-5147d671e4-20221024 and LibVEX; rerun with -h for copyright info
+==3307== Command: ./travnik configfile.ben
+==3307== Parent PID: 3305
+==3307==
+--3307--
+--3307-- Valgrind options:
+--3307-- --error-exitcode=59
+--3307-- --leak-check=full
+--3307-- --show-leak-kinds=all
+--3307-- --track-origins=yes
+--3307-- --verbose
+--3307-- --log-file=valgrind-out.txt
+--3307-- Contents of /proc/version:
+--3307-- Linux version 5.15.80-gentoo (root@livecd) (gcc (Gentoo 11.3.1_p20221209 p3) 11.3.1 20221209, GNU ld (Gentoo 2.39 p5) 2.39.0) #1 SMP Tue Jan 3 18:35:15 CET 2023
+--3307--
+--3307-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-lzcnt-rdtscp-sse3-ssse3-avx-avx2-bmi-f16c-rdrand
+--3307-- Page sizes: currently 4096, max supported 4096
+--3307-- Valgrind library directory: /usr/libexec/valgrind
+--3307-- Reading syms from /root/projects/travnik/travnik
+--3307-- Reading syms from /lib64/ld-linux-x86-64.so.2
+--3307-- Reading syms from /usr/libexec/valgrind/memcheck-amd64-linux
+--3307-- object doesn't have a dynamic symbol table
+--3307-- Scheduler: using generic scheduler lock implementation.
+--3307-- Reading suppressions file: /usr/libexec/valgrind/default.supp
+==3307== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-3307-by-root-on-???
+==3307== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-3307-by-root-on-???
+==3307== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-3307-by-root-on-???
+==3307==
+==3307== TO CONTROL THIS PROCESS USING vgdb (which you probably
+==3307== don't want to do, unless you know exactly what you're doing,
+==3307== or are doing some strange experiment):
+==3307== /usr/libexec/valgrind/../../bin/vgdb --pid=3307 ...command...
+==3307==
+==3307== TO DEBUG THIS PROCESS USING GDB: start GDB like this
+==3307== /path/to/gdb ./travnik
+==3307== and then give GDB the following command
+==3307== target remote | /usr/libexec/valgrind/../../bin/vgdb --pid=3307
+==3307== --pid is optional if only one valgrind process is running
+==3307==
+--3307-- REDIR: 0x40231b0 (ld-linux-x86-64.so.2:strlen) redirected to 0x580bbc62 (vgPlain_amd64_linux_REDIR_FOR_strlen)
+--3307-- REDIR: 0x4021980 (ld-linux-x86-64.so.2:index) redirected to 0x580bbc7c (vgPlain_amd64_linux_REDIR_FOR_index)
+--3307-- Reading syms from /usr/libexec/valgrind/vgpreload_core-amd64-linux.so
+--3307-- Reading syms from /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so
+==3307== WARNING: new redirection conflicts with existing -- ignoring it
+--3307-- old: 0x040231b0 (strlen ) R-> (0000.0) 0x580bbc62 vgPlain_amd64_linux_REDIR_FOR_strlen
+--3307-- new: 0x040231b0 (strlen ) R-> (2007.0) 0x048468e0 strlen
+--3307-- REDIR: 0x4021ba0 (ld-linux-x86-64.so.2:strcmp) redirected to 0x4847800 (strcmp)
+--3307-- REDIR: 0x4020e10 (ld-linux-x86-64.so.2:mempcpy) redirected to 0x484b1e0 (mempcpy)
+--3307-- Reading syms from /lib64/libresolv.so.2
+--3307-- Reading syms from /usr/lib64/libmd.so.0.0.5
+--3307-- object doesn't have a symbol table
+--3307-- Reading syms from /lib64/libc.so.6
+==3307== WARNING: new redirection conflicts with existing -- ignoring it
+--3307-- old: 0x04921a60 (memalign ) R-> (1011.0) 0x04845b90 memalign
+--3307-- new: 0x04921a60 (memalign ) R-> (1017.0) 0x04845b60 aligned_alloc
+==3307== WARNING: new redirection conflicts with existing -- ignoring it
+--3307-- old: 0x04921a60 (memalign ) R-> (1011.0) 0x04845b90 memalign
+--3307-- new: 0x04921a60 (memalign ) R-> (1017.0) 0x04845b30 aligned_alloc
+==3307== WARNING: new redirection conflicts with existing -- ignoring it
+--3307-- old: 0x04921a60 (memalign ) R-> (1011.0) 0x04845b90 memalign
+--3307-- new: 0x04921a60 (memalign ) R-> (1017.0) 0x04845b60 aligned_alloc
+==3307== WARNING: new redirection conflicts with existing -- ignoring it
+--3307-- old: 0x04921a60 (memalign ) R-> (1011.0) 0x04845b90 memalign
+--3307-- new: 0x04921a60 (memalign ) R-> (1017.0) 0x04845b30 aligned_alloc
+--3307-- REDIR: 0x4023350 (ld-linux-x86-64.so.2:strncmp) redirected to 0x4847070 (strncmp)
+--3307-- REDIR: 0x4927780 (libc.so.6:strnlen) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4927810 (libc.so.6:strpbrk) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4925c00 (libc.so.6:strcmp) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x493a520 (libc.so.6:wcsnlen) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4924d50 (libc.so.6:memset) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4938e70 (libc.so.6:wcslen) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4924380 (libc.so.6:memcpy@@GLIBC_2.14) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4938ca0 (libc.so.6:wcschr) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4925af0 (libc.so.6:index) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4927840 (libc.so.6:rindex) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4938d30 (libc.so.6:wcscmp) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4924f90 (libc.so.6:stpncpy) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x49392b0 (libc.so.6:wmemchr) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4927630 (libc.so.6:strncmp) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4925000 (libc.so.6:strcasecmp) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4926ba0 (libc.so.6:strcspn) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4938dc0 (libc.so.6:wcscpy) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4925a70 (libc.so.6:strcat) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4927530 (libc.so.6:strncasecmp_l) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4924290 (libc.so.6:bcmp) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4924cc0 (libc.so.6:memrchr) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4925b70 (libc.so.6:strchrnul) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4926b20 (libc.so.6:strcpy) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4925090 (libc.so.6:strcasecmp_l) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4927410 (libc.so.6:strlen) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x49276c0 (libc.so.6:strncpy) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4924f10 (libc.so.6:stpcpy) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4924aa0 (libc.so.6:memmove) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+==3307== Preferring higher priority redirection:
+--3307-- old: 0x049d4800 (__memcpy_avx_unalign) R-> (2018.0) 0x04848a10 __memcpy_avx_unaligned_erms
+--3307-- new: 0x049d4800 (__memcpy_avx_unalign) R-> (2018.1) 0x0484a270 memmove
+--3307-- REDIR: 0x4924210 (libc.so.6:memchr) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4927a20 (libc.so.6:strspn) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4924bb0 (libc.so.6:mempcpy) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x49274a0 (libc.so.6:strncasecmp) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4924e50 (libc.so.6:rawmemchr) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x49da8d0 (libc.so.6:__strrchr_avx2) redirected to 0x4846320 (rindex)
+--3307-- REDIR: 0x4921b30 (libc.so.6:calloc) redirected to 0x48454f0 (calloc)
+--3307-- REDIR: 0x49d3e00 (libc.so.6:__memchr_avx2) redirected to 0x4847880 (memchr)
+--3307-- REDIR: 0x4920dc0 (libc.so.6:malloc) redirected to 0x4840770 (malloc)
+--3307-- REDIR: 0x49d4800 (libc.so.6:__memcpy_avx_unaligned_erms) redirected to 0x484a270 (memmove)
+--3307-- REDIR: 0x49d9ca0 (libc.so.6:__strncpy_avx2) redirected to 0x4846a90 (strncpy)
+--3307-- REDIR: 0x4921360 (libc.so.6:free) redirected to 0x48430c0 (free)
+--3307-- REDIR: 0x49d7f80 (libc.so.6:__strlen_avx2) redirected to 0x48467c0 (strlen)
+--3307-- REDIR: 0x49d7260 (libc.so.6:__strchr_avx2) redirected to 0x48464a0 (index)
+--3307-- REDIR: 0x49d9650 (libc.so.6:__strncmp_avx2) redirected to 0x4846e90 (strncmp)
+--3307-- REDIR: 0x49d7bf0 (libc.so.6:__strcpy_avx2) redirected to 0x4846910 (strcpy)
+--3307-- REDIR: 0x49d40a0 (libc.so.6:__memcmp_avx2_movbe) redirected to 0x4849a10 (bcmp)
+--3307-- REDIR: 0x49d74a0 (libc.so.6:__strchrnul_avx2) redirected to 0x484acf0 (strchrnul)
+--3307-- REDIR: 0x49d7690 (libc.so.6:__strcmp_avx2) redirected to 0x4847700 (strcmp)
+--3307-- REDIR: 0x49d5200 (libc.so.6:__memset_avx2_unaligned_erms) redirected to 0x484a170 (memset)
+--3307-- REDIR: 0x49d54a0 (libc.so.6:__stpcpy_avx2) redirected to 0x4849b30 (stpcpy)
+--3307-- REDIR: 0x49d8100 (libc.so.6:__strncasecmp_avx2) redirected to 0x4847190 (strncasecmp)
+--3307-- REDIR: 0x49f6d90 (libc.so.6:__strpbrk_sse42) redirected to 0x484b5a0 (strpbrk)
+--3307-- REDIR: 0x49d47b0 (libc.so.6:__mempcpy_avx_unaligned_erms) redirected to 0x484adf0 (mempcpy)
+--3307-- REDIR: 0x49215a0 (libc.so.6:realloc) redirected to 0x4845760 (realloc)
+--3307-- REDIR: 0x49281c0 (libc.so.6:strstr) redirected to 0x48351b0 (_vgnU_ifunc_wrapper)
+--3307-- REDIR: 0x4938210 (libc.so.6:__strstr_sse2_unaligned) redirected to 0x484b3f0 (strstr)
+==3307== Invalid write of size 8
+==3307== at 0x1111A8: add_torrent (dht.c:1368)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874150 is 96 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 1
+==3307== at 0x4849A37: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x1137C7: handle (dht.c:1891)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874124 is 52 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 1
+==3307== at 0x4849A48: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x1137C7: handle (dht.c:1891)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874125 is 53 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 8
+==3307== at 0x110FCF: find_torrent (dht.c:1303)
+==3307== by 0x1137C7: handle (dht.c:1891)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 8
+==3307== at 0x116126: periodic (dht.c:2305)
+==3307== by 0x11ADB3: main (main.c:166)
+==3307== Address 0x5874188 is 152 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 4
+==3307== at 0x11615F: periodic (dht.c:2307)
+==3307== by 0x11ADB3: main (main.c:166)
+==3307== Address 0x5874120 is 48 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 4
+==3307== at 0x1164B7: periodic (dht.c:2407)
+==3307== by 0x11ADB3: main (main.c:166)
+==3307== Address 0x5874120 is 48 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 8
+==3307== at 0x116929: periodic (dht.c:2463)
+==3307== by 0x11ADB3: main (main.c:166)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 1
+==3307== at 0x4849A37: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x114205: handle (dht.c:1992)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874124 is 52 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 1
+==3307== at 0x4849A48: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x114205: handle (dht.c:1992)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874125 is 53 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 8
+==3307== at 0x110FCF: find_torrent (dht.c:1303)
+==3307== by 0x114205: handle (dht.c:1992)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 8
+==3307== at 0x116BE9: tcp_work (dht.c:2480)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874110 is 32 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 8
+==3307== at 0x11910D: tcp_work (dht.c:2878)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 1
+==3307== at 0x4849A37: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874124 is 52 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 8
+==3307== at 0x110FCF: find_torrent (dht.c:1303)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 1
+==3307== at 0x4849A37: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x113E80: handle (dht.c:1956)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874124 is 52 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 1
+==3307== at 0x4849A48: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x113E80: handle (dht.c:1956)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874125 is 53 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 8
+==3307== at 0x110FCF: find_torrent (dht.c:1303)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x113E80: handle (dht.c:1956)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 1
+==3307== at 0x4849A48: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874125 is 53 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 4
+==3307== at 0x116BFD: tcp_work (dht.c:2482)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x58740f4 is 4 bytes inside a block of size 88 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10BAD3: free_bencoding (bencoding.c:47)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x10BAB7: free_bencoding (bencoding.c:45)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x1149EA: handle (dht.c:2062)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10C94E: bdecode_safe (bencoding.c:441)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CED5: bdecode (bencoding.c:563)
+==3307== by 0x1126D0: handle (dht.c:1739)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 1
+==3307== at 0x484A2D9: memmove (vg_replace_strmem.c:1398)
+==3307== by 0x116CAC: tcp_work (dht.c:2486)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874124 is 52 bytes inside a block of size 88 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10BAD3: free_bencoding (bencoding.c:47)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x10BAB7: free_bencoding (bencoding.c:45)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x1149EA: handle (dht.c:2062)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10C94E: bdecode_safe (bencoding.c:441)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CED5: bdecode (bencoding.c:563)
+==3307== by 0x1126D0: handle (dht.c:1739)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 8
+==3307== at 0x484A36D: memmove (vg_replace_strmem.c:1398)
+==3307== by 0x116CAC: tcp_work (dht.c:2486)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874128 is 56 bytes inside a block of size 88 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10BAD3: free_bencoding (bencoding.c:47)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x10BAB7: free_bencoding (bencoding.c:45)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x1149EA: handle (dht.c:2062)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10C94E: bdecode_safe (bencoding.c:441)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CED5: bdecode (bencoding.c:563)
+==3307== by 0x1126D0: handle (dht.c:1739)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 4
+==3307== at 0x116CD6: tcp_work (dht.c:2488)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x58740f8 is 8 bytes inside a block of size 88 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10BAD3: free_bencoding (bencoding.c:47)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x10BAB7: free_bencoding (bencoding.c:45)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x1149EA: handle (dht.c:2062)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10C94E: bdecode_safe (bencoding.c:441)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CED5: bdecode (bencoding.c:563)
+==3307== by 0x1126D0: handle (dht.c:1739)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 8
+==3307== at 0x116E47: tcp_work (dht.c:2497)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874110 is 32 bytes inside a block of size 88 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10BAD3: free_bencoding (bencoding.c:47)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x10BAB7: free_bencoding (bencoding.c:45)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x1149EA: handle (dht.c:2062)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10C94E: bdecode_safe (bencoding.c:441)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CED5: bdecode (bencoding.c:563)
+==3307== by 0x1126D0: handle (dht.c:1739)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== Invalid read of size 4
+==3307== at 0x116E4B: tcp_work (dht.c:2497)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x11 is not stack'd, malloc'd or (recently) free'd
+==3307==
+==3307==
+==3307== Process terminating with default action of signal 11 (SIGSEGV): dumping core
+==3307== Access not within mapped region at address 0x11
+==3307== at 0x116E4B: tcp_work (dht.c:2497)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== If you believe this happened as a result of a stack
+==3307== overflow in your program's main thread (unlikely but
+==3307== possible), you can try to increase the size of the
+==3307== main thread stack using the --main-stacksize= flag.
+==3307== The main thread stack size used in this run was 8388608.
+==3307==
+==3307== HEAP SUMMARY:
+==3307== in use at exit: 96,566 bytes in 512 blocks
+==3307== total heap usage: 971,938 allocs, 971,426 frees, 51,589,595 bytes allocated
+==3307==
+==3307== Searching for pointers to 512 not-freed blocks
+==3307== Checked 164,344 bytes
+==3307==
+==3307== 15 bytes in 1 blocks are still reachable in loss record 1 of 23
+==3307== at 0x48407E5: malloc (vg_replace_malloc.c:393)
+==3307== by 0x4926BEA: strdup (strdup.c:42)
+==3307== by 0x494C500: tzset_internal (tzset.c:402)
+==3307== by 0x494C6F0: __tz_convert (tzset.c:577)
+==3307== by 0x116DAE: tcp_work (dht.c:2496)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 20 bytes in 1 blocks are still reachable in loss record 2 of 23
+==3307== at 0x48407E5: malloc (vg_replace_malloc.c:393)
+==3307== by 0x494BBAF: __tzstring_len (tzset.c:98)
+==3307== by 0x494D260: __tzfile_read (tzfile.c:408)
+==3307== by 0x494C513: tzset_internal (tzset.c:405)
+==3307== by 0x494C6F0: __tz_convert (tzset.c:577)
+==3307== by 0x10ECF7: sendb (dht.c:638)
+==3307== by 0x10F2EE: find_node (dht.c:699)
+==3307== by 0x10F4BE: ping_node (dht.c:728)
+==3307== by 0x10F8DF: dht_init (dht.c:798)
+==3307== by 0x11AB32: main (main.c:120)
+==3307==
+==3307== 32 bytes in 1 blocks are still reachable in loss record 3 of 23
+==3307== at 0x48407E5: malloc (vg_replace_malloc.c:393)
+==3307== by 0x4922FAF: __libc_dynarray_emplace_enlarge (dynarray_emplace_enlarge.c:61)
+==3307== by 0x49B6478: resolv_conf_array_add__ (dynarray-skeleton.c:281)
+==3307== by 0x49B6478: resolv_conf_array_add (dynarray-skeleton.c:309)
+==3307== by 0x49B6478: __resolv_conf_attach (resolv_conf.c:604)
+==3307== by 0x49B0FFE: __res_vinit (res_init.c:632)
+==3307== by 0x49B0FFE: __res_ninit (res_init.c:113)
+==3307== by 0x1159FC: periodic (dht.c:2253)
+==3307== by 0x11ACB4: main (main.c:137)
+==3307==
+==3307== 32 bytes in 1 blocks are still reachable in loss record 4 of 23
+==3307== at 0x48457DF: realloc (vg_replace_malloc.c:1451)
+==3307== by 0x119CEE: connection (tcp.c:53)
+==3307== by 0x1168DE: periodic (dht.c:2455)
+==3307== by 0x11ADB3: main (main.c:166)
+==3307==
+==3307== 40 bytes in 1 blocks are still reachable in loss record 5 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10DD4B: bucket_init (dht.c:215)
+==3307== by 0x10F539: dht_init (dht.c:747)
+==3307== by 0x11AB32: main (main.c:120)
+==3307==
+==3307== 40 bytes in 1 blocks are still reachable in loss record 6 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10DD4B: bucket_init (dht.c:215)
+==3307== by 0x10F549: dht_init (dht.c:748)
+==3307== by 0x11AB32: main (main.c:120)
+==3307==
+==3307== 41 bytes in 2 blocks are still reachable in loss record 7 of 23
+==3307== at 0x48407E5: malloc (vg_replace_malloc.c:393)
+==3307== by 0x494BB55: __tzstring_len (tzset.c:98)
+==3307== by 0x494D260: __tzfile_read (tzfile.c:408)
+==3307== by 0x494C513: tzset_internal (tzset.c:405)
+==3307== by 0x494C6F0: __tz_convert (tzset.c:577)
+==3307== by 0x10ECF7: sendb (dht.c:638)
+==3307== by 0x10F2EE: find_node (dht.c:699)
+==3307== by 0x10F4BE: ping_node (dht.c:728)
+==3307== by 0x10F8DF: dht_init (dht.c:798)
+==3307== by 0x11AB32: main (main.c:120)
+==3307==
+==3307== 88 bytes in 1 blocks are still reachable in loss record 8 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x49B56BE: get_locked_global (resolv_conf.c:94)
+==3307== by 0x49B56BE: get_locked_global (resolv_conf.c:86)
+==3307== by 0x49B5AE8: __resolv_conf_get_current (resolv_conf.c:127)
+==3307== by 0x49B0FEB: __res_vinit (res_init.c:628)
+==3307== by 0x49B0FEB: __res_ninit (res_init.c:113)
+==3307== by 0x1159FC: periodic (dht.c:2253)
+==3307== by 0x11ACB4: main (main.c:137)
+==3307==
+==3307== 200 bytes in 5 blocks are still reachable in loss record 9 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10DD4B: bucket_init (dht.c:215)
+==3307== by 0x110639: split (dht.c:1102)
+==3307== by 0x110E5C: replied (dht.c:1254)
+==3307== by 0x110E7C: replied (dht.c:1255)
+==3307== by 0x114180: handle (dht.c:1984)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 200 bytes in 5 blocks are still reachable in loss record 10 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10DDCA: peer_init (dht.c:262)
+==3307== by 0x113EBE: handle (dht.c:1961)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 211 bytes in 1 blocks are still reachable in loss record 11 of 23
+==3307== at 0x48407E5: malloc (vg_replace_malloc.c:393)
+==3307== by 0x4923284: __libc_alloc_buffer_allocate (alloc_buffer_allocate.c:26)
+==3307== by 0x49B5E25: alloc_buffer_allocate (alloc_buffer.h:143)
+==3307== by 0x49B5E25: __resolv_conf_allocate (resolv_conf.c:391)
+==3307== by 0x49B12F1: __resolv_conf_load (res_init.c:599)
+==3307== by 0x49B5B76: __resolv_conf_get_current (resolv_conf.c:140)
+==3307== by 0x49B0FEB: __res_vinit (res_init.c:628)
+==3307== by 0x49B0FEB: __res_ninit (res_init.c:113)
+==3307== by 0x1159FC: periodic (dht.c:2253)
+==3307== by 0x11ACB4: main (main.c:137)
+==3307==
+==3307== 440 bytes in 5 blocks are still reachable in loss record 12 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10D9FD: node_init (dht.c:98)
+==3307== by 0x110A30: replied (dht.c:1213)
+==3307== by 0x110E7C: replied (dht.c:1255)
+==3307== by 0x110E7C: replied (dht.c:1255)
+==3307== by 0x114180: handle (dht.c:1984)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 760 bytes in 19 blocks are still reachable in loss record 13 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10DDCA: peer_init (dht.c:262)
+==3307== by 0x114309: handle (dht.c:2003)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 800 bytes in 5 blocks are still reachable in loss record 14 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 1,167 bytes in 1 blocks are still reachable in loss record 15 of 23
+==3307== at 0x48407E5: malloc (vg_replace_malloc.c:393)
+==3307== by 0x494CBA1: __tzfile_read (tzfile.c:275)
+==3307== by 0x494C513: tzset_internal (tzset.c:405)
+==3307== by 0x494C6F0: __tz_convert (tzset.c:577)
+==3307== by 0x10ECF7: sendb (dht.c:638)
+==3307== by 0x10F2EE: find_node (dht.c:699)
+==3307== by 0x10F4BE: ping_node (dht.c:728)
+==3307== by 0x10F8DF: dht_init (dht.c:798)
+==3307== by 0x11AB32: main (main.c:120)
+==3307==
+==3307== 1,320 bytes in 33 blocks are still reachable in loss record 16 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10DD4B: bucket_init (dht.c:215)
+==3307== by 0x110639: split (dht.c:1102)
+==3307== by 0x110E5C: replied (dht.c:1254)
+==3307== by 0x114180: handle (dht.c:1984)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 2,080 bytes in 13 blocks are still reachable in loss record 17 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x11A183: found_torrent (main.c:56)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 2,464 bytes in 28 blocks are still reachable in loss record 18 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10D9FD: node_init (dht.c:98)
+==3307== by 0x110A30: replied (dht.c:1213)
+==3307== by 0x110E7C: replied (dht.c:1255)
+==3307== by 0x114180: handle (dht.c:1984)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 7,376 bytes in 1 blocks are still reachable in loss record 19 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10F507: dht_init (dht.c:744)
+==3307== by 0x11AB32: main (main.c:120)
+==3307==
+==3307== 9,856 bytes in 112 blocks are still reachable in loss record 20 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10D9FD: node_init (dht.c:98)
+==3307== by 0x111AB0: replied_torrent_node (dht.c:1568)
+==3307== by 0x114276: handle (dht.c:1997)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 12,721 bytes in 2 blocks are still reachable in loss record 21 of 23
+==3307== at 0x48406F5: malloc (vg_replace_malloc.c:392)
+==3307== by 0x118491: tcp_work (dht.c:2662)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 23,936 bytes in 272 blocks are still reachable in loss record 22 of 23
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10D9FD: node_init (dht.c:98)
+==3307== by 0x110A30: replied (dht.c:1213)
+==3307== by 0x114180: handle (dht.c:1984)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== 32,727 bytes in 1 blocks are still reachable in loss record 23 of 23
+==3307== at 0x48407E5: malloc (vg_replace_malloc.c:393)
+==3307== by 0x11687B: periodic (dht.c:2452)
+==3307== by 0x11ADB3: main (main.c:166)
+==3307==
+==3307== LEAK SUMMARY:
+==3307== definitely lost: 0 bytes in 0 blocks
+==3307== indirectly lost: 0 bytes in 0 blocks
+==3307== possibly lost: 0 bytes in 0 blocks
+==3307== still reachable: 96,566 bytes in 512 blocks
+==3307== suppressed: 0 bytes in 0 blocks
+==3307==
+==3307== ERROR SUMMARY: 2115 errors from 25 contexts (suppressed: 0 from 0)
+==3307==
+==3307== 1 errors in context 1 of 25:
+==3307== Invalid read of size 4
+==3307== at 0x116E4B: tcp_work (dht.c:2497)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x11 is not stack'd, malloc'd or (recently) free'd
+==3307==
+==3307==
+==3307== 1 errors in context 2 of 25:
+==3307== Invalid read of size 8
+==3307== at 0x116E47: tcp_work (dht.c:2497)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874110 is 32 bytes inside a block of size 88 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10BAD3: free_bencoding (bencoding.c:47)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x10BAB7: free_bencoding (bencoding.c:45)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x1149EA: handle (dht.c:2062)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10C94E: bdecode_safe (bencoding.c:441)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CED5: bdecode (bencoding.c:563)
+==3307== by 0x1126D0: handle (dht.c:1739)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 1 errors in context 3 of 25:
+==3307== Invalid read of size 4
+==3307== at 0x116CD6: tcp_work (dht.c:2488)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x58740f8 is 8 bytes inside a block of size 88 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10BAD3: free_bencoding (bencoding.c:47)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x10BAB7: free_bencoding (bencoding.c:45)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x1149EA: handle (dht.c:2062)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10C94E: bdecode_safe (bencoding.c:441)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CED5: bdecode (bencoding.c:563)
+==3307== by 0x1126D0: handle (dht.c:1739)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 1 errors in context 4 of 25:
+==3307== Invalid read of size 4
+==3307== at 0x116BFD: tcp_work (dht.c:2482)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x58740f4 is 4 bytes inside a block of size 88 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10BAD3: free_bencoding (bencoding.c:47)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x10BAB7: free_bencoding (bencoding.c:45)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x1149EA: handle (dht.c:2062)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10C94E: bdecode_safe (bencoding.c:441)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CED5: bdecode (bencoding.c:563)
+==3307== by 0x1126D0: handle (dht.c:1739)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 1 errors in context 5 of 25:
+==3307== Invalid write of size 8
+==3307== at 0x1111A8: add_torrent (dht.c:1368)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874150 is 96 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 2 errors in context 6 of 25:
+==3307== Invalid read of size 8
+==3307== at 0x484A36D: memmove (vg_replace_strmem.c:1398)
+==3307== by 0x116CAC: tcp_work (dht.c:2486)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874128 is 56 bytes inside a block of size 88 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10BAD3: free_bencoding (bencoding.c:47)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x10BAB7: free_bencoding (bencoding.c:45)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x1149EA: handle (dht.c:2062)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10C94E: bdecode_safe (bencoding.c:441)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CED5: bdecode (bencoding.c:563)
+==3307== by 0x1126D0: handle (dht.c:1739)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 4 errors in context 7 of 25:
+==3307== Invalid read of size 1
+==3307== at 0x484A2D9: memmove (vg_replace_strmem.c:1398)
+==3307== by 0x116CAC: tcp_work (dht.c:2486)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874124 is 52 bytes inside a block of size 88 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10BAD3: free_bencoding (bencoding.c:47)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x10BAB7: free_bencoding (bencoding.c:45)
+==3307== by 0x10BA98: free_bencoding (bencoding.c:43)
+==3307== by 0x1149EA: handle (dht.c:2062)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10C94E: bdecode_safe (bencoding.c:441)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CB4D: bdecode_safe (bencoding.c:471)
+==3307== by 0x10CED5: bdecode (bencoding.c:563)
+==3307== by 0x1126D0: handle (dht.c:1739)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 4 errors in context 8 of 25:
+==3307== Invalid read of size 8
+==3307== at 0x110FCF: find_torrent (dht.c:1303)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x113E80: handle (dht.c:1956)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 4 errors in context 9 of 25:
+==3307== Invalid read of size 1
+==3307== at 0x4849A37: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x113E80: handle (dht.c:1956)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874124 is 52 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 5 errors in context 10 of 25:
+==3307== Invalid read of size 1
+==3307== at 0x4849A48: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874125 is 53 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 5 errors in context 11 of 25:
+==3307== Invalid read of size 1
+==3307== at 0x4849A48: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x113E80: handle (dht.c:1956)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874125 is 53 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 11 errors in context 12 of 25:
+==3307== Invalid read of size 8
+==3307== at 0x110FCF: find_torrent (dht.c:1303)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 11 errors in context 13 of 25:
+==3307== Invalid read of size 1
+==3307== at 0x4849A37: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x111139: add_torrent (dht.c:1359)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874124 is 52 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 13 errors in context 14 of 25:
+==3307== Invalid read of size 8
+==3307== at 0x116929: periodic (dht.c:2463)
+==3307== by 0x11ADB3: main (main.c:166)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 13 errors in context 15 of 25:
+==3307== Invalid read of size 4
+==3307== at 0x1164B7: periodic (dht.c:2407)
+==3307== by 0x11ADB3: main (main.c:166)
+==3307== Address 0x5874120 is 48 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 13 errors in context 16 of 25:
+==3307== Invalid read of size 4
+==3307== at 0x11615F: periodic (dht.c:2307)
+==3307== by 0x11ADB3: main (main.c:166)
+==3307== Address 0x5874120 is 48 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 13 errors in context 17 of 25:
+==3307== Invalid read of size 8
+==3307== at 0x116126: periodic (dht.c:2305)
+==3307== by 0x11ADB3: main (main.c:166)
+==3307== Address 0x5874188 is 152 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 29 errors in context 18 of 25:
+==3307== Invalid read of size 8
+==3307== at 0x11910D: tcp_work (dht.c:2878)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 30 errors in context 19 of 25:
+==3307== Invalid read of size 8
+==3307== at 0x116BE9: tcp_work (dht.c:2480)
+==3307== by 0x11941A: work (dht.c:2906)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874110 is 32 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 84 errors in context 20 of 25:
+==3307== Invalid read of size 1
+==3307== at 0x4849A48: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x1137C7: handle (dht.c:1891)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874125 is 53 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 139 errors in context 21 of 25:
+==3307== Invalid read of size 8
+==3307== at 0x110FCF: find_torrent (dht.c:1303)
+==3307== by 0x1137C7: handle (dht.c:1891)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 139 errors in context 22 of 25:
+==3307== Invalid read of size 1
+==3307== at 0x4849A37: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x1137C7: handle (dht.c:1891)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874124 is 52 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 457 errors in context 23 of 25:
+==3307== Invalid read of size 1
+==3307== at 0x4849A48: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x114205: handle (dht.c:1992)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874125 is 53 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 567 errors in context 24 of 25:
+==3307== Invalid read of size 8
+==3307== at 0x110FCF: find_torrent (dht.c:1303)
+==3307== by 0x114205: handle (dht.c:1992)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874148 is 88 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307==
+==3307== 567 errors in context 25 of 25:
+==3307== Invalid read of size 1
+==3307== at 0x4849A37: bcmp (vg_replace_strmem.c:1219)
+==3307== by 0x110FC0: find_torrent (dht.c:1301)
+==3307== by 0x114205: handle (dht.c:1992)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Address 0x5874124 is 52 bytes inside a block of size 160 free'd
+==3307== at 0x484312B: free (vg_replace_malloc.c:884)
+==3307== by 0x10E203: torrent_free (dht.c:407)
+==3307== by 0x1110AD: remove_torrent (dht.c:1330)
+==3307== by 0x11110A: oom (dht.c:1345)
+==3307== by 0x11118E: add_torrent (dht.c:1366)
+==3307== by 0x11A1F8: found_torrent (main.c:60)
+==3307== by 0x1137FB: handle (dht.c:1892)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307== Block was alloc'd at
+==3307== at 0x484559F: calloc (vg_replace_malloc.c:1340)
+==3307== by 0x10E021: torrent_init (dht.c:355)
+==3307== by 0x113E3A: handle (dht.c:1954)
+==3307== by 0x1194A7: work (dht.c:2910)
+==3307== by 0x11AD27: main (main.c:154)
+==3307==
+==3307== ERROR SUMMARY: 2115 errors from 25 contexts (suppressed: 0 from 0)
diff --git a/src/dht.c b/src/dht.c
index 137c5d8..c5fd98b 100644
--- a/src/dht.c
+++ b/src/dht.c
@@ -84,6 +84,8 @@ struct node {
time_t last_received; /**< time when I received the last packet from it */
time_t last_sent; /**< time when I sent the last query to it. not incremented if it has unanswered queries. */
struct node * next;
+#define SERVER_ERRORS_BAD 15
+ unsigned server_errors; /**< number of server errors, set node grade to bad if more than SERVER_ERRORS_BAD. reset when replied() */
};
/**
@@ -147,6 +149,8 @@ char * node_grade_str (enum node_grade g) {
#define QUESTIONABLE_AFTER (15*60)
enum node_grade node_grade (const struct node * n) {
+ if (n->server_errors > SERVER_ERRORS_BAD)
+ return bad;
if (n->last_received + QUESTIONABLE_AFTER < seconds()) {
if (n->last_sent + 60 < seconds() && n->unanswered > 1)
return bad;
@@ -236,7 +240,8 @@ enum flags {
goodmeta = 1 << 3, /**< peer gave us good metadata that is currently stored in the torrent */
badmeta = 1 << 4, /**< peer gave us bogus metadata that does not match it's hash */
unreachable = 1 << 5, /**< pear unreachable - timed out */
- requested = 1 << 6 /**< because choking is unimplemented, packets are sent like with TFTP, a request is sent only when a reply is received */
+ requested = 1 << 6, /**< because choking is unimplemented, packets are sent like with TFTP, a request is sent only when a reply is received */
+ protocolerror = 1 << 7 /**< I don't understand you my g */
};
/**
@@ -278,7 +283,7 @@ void peer_print (FILE * s, const struct peer * p) {
char remote[INET6_ADDRSTRLEN + 64];
if (!inet_ntop(p->addr.sin6_family, p->addr.sin6_addr.s6_addr, remote, INET6_ADDRSTRLEN+7))
snprintf(remote, sizeof remote, "(inet_ntop: %s)", strerror(errno));
- fprintf(s, "%s/%d %s%s%s%s%s%s", remote, ntohs(p->addr.sin6_port), p->flags & nometasupport ? " nometasupport" : "", p->flags & nometa ? " nometa" : "", p->flags & goodmeta ? " goodmeta" : "", p->flags & badmeta ? " badmeta" : "", p->flags & unreachable ? " unreachable" : "", p->flags & requested ? " requested" : "");
+ fprintf(s, "%s/%d %s%s%s%s%s%s%s", remote, ntohs(p->addr.sin6_port), p->flags & nometasupport ? " nometasupport" : "", p->flags & nometa ? " nometa" : "", p->flags & goodmeta ? " goodmeta" : "", p->flags & badmeta ? " badmeta" : "", p->flags & unreachable ? " unreachable" : "", p->flags & requested ? " requested" : "", p->flags & protocolerror ? " protocolerror" : "");
}
/**
@@ -337,6 +342,7 @@ struct torrent {
unsigned char * packet; /**< packet being constructed from tcp for info torrents, 32727 bytes */
int recvd; /**< length of received data for current packet */
char * software; /**< can be read from disconnection() - software string client sent, may be NULL */
+ time_t ttl; /**< if nonzero, torrent will get his ->type cleared after this seconds() timestamp. set to seconds()+512 for example */
};
/**
@@ -522,6 +528,10 @@ struct dht {
#define PINGS_CAP 256 /**< capacity of circular buffer, one element is ~28 bytes, so this is 7168 B */
struct sockaddr_in6 pings[PINGS_CAP]; /**< circular buffer of recent pings */
unsigned periods; /**< number of times periodic() was called */
+ unsigned rxqp;
+ unsigned txqp;
+ unsigned rxrp;
+ unsigned txrp;
};
/**
@@ -601,6 +611,13 @@ void possible_torrent (struct dht * d __attribute__((unused)), const unsigned ch
*/
void sendb (struct dht * d, struct bencoding * b, const struct sockaddr_in6 * a) {
+ struct bencoding * y = bpath(b, "y");
+ if (y && y->type & string && y->valuelen >= 1) {
+ if (y->value[0] == 'r')
+ d->txrp++;
+ else
+ d->txqp++;
+ }
char remote[INET6_ADDRSTRLEN + 64];
if (!inet_ntop(a->sin6_family, &a->sin6_addr, remote, INET6_ADDRSTRLEN+7))
snprintf(remote, sizeof remote, "(inet_ntop: %s)", strerror(errno));
@@ -1129,7 +1146,7 @@ unsigned int distance (const unsigned char * a, const unsigned char * b) {
}
/**
- * returns 1 if bucket is perfect, meaning it is fresh, has K nodes, and all nodes are good. bucket that contains id is almost never perfect, as it can usually be split into smaller buckets, that's why param d is required to get own id
+ * returns 1 if bucket is perfect, meaning it is fresh, has K nodes, and no node is bad. bucket that contains id is almost never perfect, as it can usually be split into smaller buckets, that's why param d is required to get own id
*
* if d is NULL, it's not checked whether we fall into the bucket and whether it could be split
*
@@ -1137,9 +1154,9 @@ unsigned int distance (const unsigned char * a, const unsigned char * b) {
* @param b [in] the bucket
*/
-int bucket_good (const struct dht * d, const struct bucket * b) {
+int bucket_grade (const struct dht * d, const struct bucket * b) {
if (d) {
- if (!bucket_good(NULL, b))
+ if (!bucket_grade(NULL, b))
return 0;
if (in_bucket(d->id, b)) {
struct node * n = b->nodes;
@@ -1156,7 +1173,7 @@ int bucket_good (const struct dht * d, const struct bucket * b) {
return 0;
struct node * n = b->nodes;
if (n) {
- if (node_grade(n) != good)
+ if (node_grade(n) == bad)
return 0;
n = n->next;
}
@@ -1179,8 +1196,6 @@ int bucket_good (const struct dht * d, const struct bucket * b) {
*/
void replied (const struct dht * d, const unsigned char * id, const struct sockaddr_in6 * addr) {
- if (!memcmp(d->id, id, 20)) // WE COULDN'T'VE POSSIBLY REPLIED TO OURSELVES!
- return;
struct bucket * b = d->buckets;
if (family(addr->sin6_addr.s6_addr) == AF_INET6)
b = d->buckets6;
@@ -1188,10 +1203,12 @@ void replied (const struct dht * d, const unsigned char * id, const struct socka
struct node * found = find(id, &b, &n);
if (found) {
found->last_received = seconds();
- found->unanswered = 0;
+ found->server_errors = found->unanswered = 0;
return;
}
- if (bucket_good(d, b))
+ if (!memcmp(d->id, id, 15)) // WE COULDN'T'VE POSSIBLY REPLIED TO OURSELVES - or sybil attack
+ return;
+ if (bucket_grade(d, b))
return;
struct node * node = node_init();
memcpy(&node->addr, addr, sizeof *addr);
@@ -1252,14 +1269,14 @@ void replied (const struct dht * d, const unsigned char * id, const struct socka
void potential_node (struct dht * d, const struct sockaddr_in6 * a, const unsigned char * id) {
if (!a->sin6_port)
return; // sorry, I can't send to port 0. this is a mistake or a malicious node
- if (!memcmp(d->id, id, 20)) // we are not a potential node of ourselves
+ if (!memcmp(d->id, id, 15)) // we are not a potential node of ourselves, if 15 bytes are same : sybil
return;
struct bucket * bucket = d->buckets;
if (family(a->sin6_addr.s6_addr) == AF_INET6)
bucket = d->buckets6;
if (find(id, &bucket, NULL))
return;
- if (!bucket_good(d, bucket))
+ if (!bucket_grade(d, bucket))
ping_node(d, a);
}
@@ -1323,7 +1340,7 @@ void remove_torrent (struct dht * d, struct torrent * t) {
void oom (struct dht * d) {
struct torrent * drop = d->last_torrent;
- while (drop && drop->type)
+ while (drop && (drop->type || drop->dl))
drop = drop->prev;
remove_torrent(d, drop);
}
@@ -1345,6 +1362,8 @@ struct torrent * add_torrent (struct dht * d, struct torrent * t) {
torrent_free(t);
return found;
}
+ if (d->torrents_num >= d->torrents_max)
+ oom(d);
if (d->torrents)
d->torrents->prev = t;
else
@@ -1359,8 +1378,6 @@ struct torrent * add_torrent (struct dht * d, struct torrent * t) {
else
memcpy(d->sample+20*(rand() % 3000), t->hash, 20);
#endif
- if (d->torrents_num >= d->torrents_max)
- oom(d);
return t;
}
@@ -1385,12 +1402,14 @@ struct peer * add_peer (struct dht * d, struct torrent * t, struct peer * p) {
unsigned l = 0;
while (*peer) {
l++;
- if (!memcmp(&(*peer)->addr, &p->addr, sizeof p->addr)) {
+ if (!memcmp((*peer)->addr.sin6_addr.s6_addr, p->addr.sin6_addr.s6_addr, 16)) { // ignore multiple peers on same port
peer_free(p);
return *peer;
}
if (*peer != t->dl)
nondl = peer;
+ else // dls are holy
+ goto c;
if ((*peer)->flags & badmeta)
bad = peer;
if ((*peer)->flags & nometasupport && !(bad && (*bad) && (*bad)->flags & badmeta))
@@ -1404,6 +1423,7 @@ struct peer * add_peer (struct dht * d, struct torrent * t, struct peer * p) {
*peer = next;
continue;
}
+ c:
peer = &(*peer)->next;
}
if (bad && l > d->peers_per_torrent_max) {
@@ -1592,9 +1612,10 @@ void compact (struct dht * d, const char * value, int len, struct torrent * t) {
memcpy(addr.sin6_addr.s6_addr+(len == 4+2+20 ? 12 : 0), value + 20, len == 4+2+20 ? 4 : 16);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpointer-sign"
- potential_node(d, &addr, value); // NOTE02 at the beginning, a lot of packets will be sent, since every reply of potential_node will generate K replies. naively this would generate an exponentially increasing number of packets, in increasing powers of 8 (8**n). to prevent an absolute resource hog, this is only done when node would be useful and would contribute to the routing table
if (t)
potential_torrent_node(d, t, &addr, value);
+ else
+ potential_node(d, &addr, value); // NOTE02 at the beginning, a lot of packets will be sent, since every reply of potential_node will generate K replies. naively this would generate an exponentially increasing number of packets, in increasing powers of 8 (8**n). to prevent an absolute resource hog, this is only done when node would be useful and would contribute to the routing table
#pragma GCC diagnostic pop
}
@@ -1736,6 +1757,12 @@ void handle (struct dht * d, char * pkt, int len, struct sockaddr_in6 addr) {
L(incoming_dht, d, "handle(%s): %s", remote, out);
}
struct bencoding * y = bpath(b, "y");
+ if (y && y->type & string && y->valuelen >= 1) {
+ if (y->value[0] == 'r')
+ d->rxrp++;
+ else
+ d->rxqp++;
+ }
char * msg_type = "";
if (y && y->type & string)
msg_type = y->value;
@@ -1864,18 +1891,16 @@ void handle (struct dht * d, char * pkt, int len, struct sockaddr_in6 addr) {
struct torrent * torrent = find_torrent(d, hash->value, 20);
d->possible_torrent(d, hash->value, torrent);
#pragma GCC diagnostic pop
- unsigned i = 0;
+ unsigned i = 8;
if (torrent) {
struct peer * peer = torrent->peers;
struct bencoding * values = calloc(1, sizeof *values);
values->type = list;
- while (peer) { // TODO implement peer preference: prefer sending peers that responded to us
+ while (i-- && peer) { // TODO implement peer preference: prefer sending peers that responded to us
if (family(peer->addr.sin6_addr.s6_addr) != family(addr.sin6_addr.s6_addr)) // possible
goto c;
- if (peer->flags & unreachable)
+ if (peer->flags & (unreachable || protocolerror))
goto c;
- if (i++ > K)
- break;
struct bencoding * value = calloc(1, sizeof *value);
memcpy((value->value = malloc((value->valuelen = ADDRLEN(family(peer->addr.sin6_addr.s6_addr))+2))), peer->addr.sin6_addr.s6_addr, ADDRLEN(family(peer->addr.sin6_addr.s6_addr)));
memcpy(value->value+ADDRLEN(family(peer->addr.sin6_addr.s6_addr)), &peer->addr.sin6_port, 2);
@@ -1988,10 +2013,10 @@ void handle (struct dht * d, char * pkt, int len, struct sockaddr_in6 addr) {
struct bencoding * nodes = bpath(b, "r/nodes");
struct bencoding * nodes6 = bpath(b, "r/nodes6");
if (nodes && nodes->type & string && !(nodes->valuelen % 26))
- for (unsigned i = 0; i < MIN(nodes->valuelen, K); i += 26)
+ for (unsigned i = 0; i < MIN(nodes->valuelen, K*26); i += 26)
compact(d, nodes->value+i, 26, torrent);
if (nodes6 && nodes6->type & string && !(nodes6->valuelen % 38))
- for (unsigned i = 0; i < MIN(nodes6->valuelen, K); i += 38)
+ for (unsigned i = 0; i < MIN(nodes6->valuelen, K*38); i += 38)
compact(d, nodes6->value+i, 38, torrent);
break;
case 'E':
@@ -2148,8 +2173,8 @@ int refresh (struct dht * d, int fam) {
node_free(old);
continue;
case questionable:
- if (!(rand() % (QUESTIONABLE_AFTER/PERIODIC)))
- ping_node(d, &(*n)->addr); // NOTE03 about not pinging questionable nodes: this ensures a constant regeneration of the routing table. this is just an idea, if the client frequently gets in a situation without any nodes in the routing table, remove the comment before ping_node call.
+ // if (!(rand() % ())) // I disabled it again because it was too spammy
+ // ping_node(d, &(*n)->addr); // NOTE03 about not pinging questionable nodes: this ensures a constant regeneration of the routing table. this is just an idea, if the client frequently gets in a situation without any nodes in the routing table, remove the comment before ping_node call.
break; // update on why I uncommented: to mitigate sybil attack, it's baje important to prefer old nodes
case good:
nrgood++;
@@ -2159,7 +2184,8 @@ int refresh (struct dht * d, int fam) {
}
b = b->next;
}
- if (buckets > 32) { // sybil attack - node is broken - clear whole routing table, keeping one bucket
+ if (buckets > 64) { // sybil attack - node is broken - clear whole routing table, keeping one bucket
+ dht_print(d->log, d);
L(disagreement, d, "@@@@@@ SYBIL ATTACK - CLEARING ROUTING TABLE @@@@@@");
int keep_first = rand() % 2; // should we even keep one bucket? the sybil node has a 1/2
if (keep_first) { // chance of having stared in the bucket farthest away, so it's stored there ...
@@ -2215,7 +2241,6 @@ int refresh (struct dht * d, int fam) {
void periodic (struct dht * d) {
d->periods++;
- L(debug, d, "called");
int dns = 0;
if (!refresh(d, AF_INET))
dns++;
@@ -2277,6 +2302,8 @@ void periodic (struct dht * d) {
;
struct torrent * t = d->torrents;
while (t) {
+ if (t->ttl && seconds() > t->ttl)
+ t->type = 0;
if (t->type & (peers | announce)) {
/*
struct node * n = t->nodes;
@@ -2388,7 +2415,7 @@ void periodic (struct dht * d) {
struct peer * p = t->peers;
int c = 0;
while (p) {
- if (!(p->flags & (badmeta | nometasupport | unreachable)))
+ if (!(p->flags & (badmeta | nometasupport | unreachable | protocolerror)))
c++;
p = p->next;
}
@@ -2397,7 +2424,7 @@ void periodic (struct dht * d) {
int s = rand() % c; // OB1 untested
p = t->peers;
while (p) {
- if (!(p->flags & (badmeta | nometasupport | unreachable)) && !s--) {
+ if (!(p->flags & (badmeta | nometasupport | unreachable | protocolerror)) && !s--) {
t->dl = p;
t->state = 0;
t->socket = socket(AF_INET6, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
@@ -2435,7 +2462,10 @@ void periodic (struct dht * d) {
a:
t = t->next;
}
- return;
+ L(debug, d, "txqp=%u rxrp=%u rxqp=%u txrp=%u", d->txqp, d->rxrp, d->rxqp, d->txrp);
+ if (d->txqp > 16384 || d->rxrp > 16384 || d->rxqp > 16384 || d->txrp > 16384)
+ raise(SIGINT);
+ d->txqp = d->txrp = d->rxqp = d->rxrp = 0;
}
/**
@@ -2506,9 +2536,10 @@ void tcp_work (struct dht * d) {
}
if (!(t->state & ~(handshake_sent | incoming | outgoing))) {
int ret = recv(t->socket, packet, 1+19+8+20*2, MSG_DONTWAIT);
+ L(expected, d, "handshake recv returned value %d, t->recvd == %d", ret, t->recvd);
if (ret == 0) {
L(disagreement, d, "received 0 bytes instead of handshake. EOF");
- t->dl->flags |= nometasupport;
+ t->dl->flags |= protocolerror;
disconnect(t);
goto c;
}
@@ -2522,7 +2553,7 @@ void tcp_work (struct dht * d) {
}
if (ret < 1+19+8+20*2) { // c'mon, this could've arrived in one packet HACK UGLY!
L(disagreement, d, "expected handshake, received only %d bytes", ret);
- t->dl->flags |= nometasupport; // cause it sent a nonsensical packet
+ t->dl->flags |= protocolerror; // cause it sent a nonsensical packet
disconnect(t);
goto c;
}
@@ -2554,31 +2585,44 @@ void tcp_work (struct dht * d) {
disconnect(t);
}
goto c;
+ } else if (!ret){
+ L(disagreement, d, "peer EOF");
+ t->dl->flags |= protocolerror;
+ disconnect(t);
+ goto c;
} else {
- uint32_t l = ntohl(*((uint32_t *) t->packet));
- L(debug, d, "found length of a packet to be %u", l);
d->tr += ret;
t->recvd += ret;
}
+ if (t->recvd == 4) {
+ uint32_t l = ntohl(*((uint32_t *) t->packet));
+ L(debug, d, "found length of a packet to be %u", l);
+ }
}
if (t->recvd >= 4) {
+ char buf[41];
+ buf[40] = '\0';
+ bin2hex(buf, t->packet, MIN(20, t->recvd));
if (t->packet[0]) {
- char buf[41];
- buf[40] = '\0';
- bin2hex(buf, t->packet, 20);
- L(disagreement, d, "peer wants to send too big of a packet %s", buf);
- t->dl->flags |= nometasupport; // too big pkt, sorry
+ L(disagreement, d, "peer wants to send too big of a packet %.*s", MIN(20, t->recvd)*2, buf);
+ t->dl->flags |= protocolerror; // too big pkt, sorry
disconnect(t);
goto c;
}
uint32_t l = ntohl(*((uint32_t *) t->packet));
- int ret = recv(t->socket, t->packet+t->recvd, MIN(l, 32727-t->recvd), MSG_DONTWAIT);
+ int ret = recv(t->socket, t->packet+t->recvd, MIN(l-t->recvd+4, 32727-t->recvd), MSG_DONTWAIT);
+ L(debug, d, "reading packet content: read %d bytes", ret);
if (ret < 0) {
if (errno != EAGAIN) {
L(std_fail, d, "recv(TCP): %s (%d)", strerror(errno), errno);
disconnect(t);
}
goto c;
+ } else if (!ret) {
+ L(disagreement, d, "peer EOF");
+ t->dl->flags |= protocolerror;
+ disconnect(t);
+ goto c;
} else {
d->tr += ret;
t->recvd += ret;
@@ -2720,6 +2764,7 @@ void tcp_work (struct dht * d) {
}
free_bencoding(e);
end_packet:
+ L(debug, d, "cleared packet recvd to 0");
t->recvd = 0;
}
/*
diff --git a/src/main.c b/src/main.c
index 7527921..4368e21 100644
--- a/src/main.c
+++ b/src/main.c
@@ -31,19 +31,33 @@ void handler (int s) {
break;
}
}
+time_t last_added = 0;
void found_torrent (struct dht * d __attribute__((unused)), const unsigned char * h, struct torrent * t) {
char buf[128];
bin2hex(buf, h, 20);
buf[40] = '\0';
- L(debug, d, "magnet:?xt=urn:btih:%s%s", buf, t ? " stored" : "");
+ struct stat statbuf;
+ strcat(buf, ".torrent");
+ if (!stat(buf, &statbuf)) {
+ L(expected, d, "%s already exists", buf);
+ return;
+ }
+ L(debug, d, "%s%s", buf, t ? " stored" : " new");
if (t) {
- struct stat statbuf;
- strcat(buf, ".torrent");
- if (!stat(buf, &statbuf)) {
- L(expected, d, "%s already exists", buf);
+ if (!t->type)
+ t->ttl = seconds()+512;
+ t->type |= info | peers;
+ } else {
+ if (last_added + 10 > seconds()) {
+ L(debug, d, "not adding a torrent this fast");
return;
- } else
- t->type |= info | peers;
+ }
+ last_added = seconds();
+ t = torrent_init();
+ memcpy(t->hash, h, 20);
+ t->type |= info | peers;
+ t->ttl = seconds()+128;
+ add_torrent(d, t);
}
}
int main (int argc, char ** argv) {
@@ -114,6 +128,8 @@ int main (int argc, char ** argv) {
dht->pollfds_size = &pollfds_size;
dht->nfds = &nfds;
dht->verbosity |= (getenv("TRAVNIK_INCOMING_DHT") ? incoming_dht : 0) | (getenv("TRAVNIK_OUTGOING_DHT") ? outgoing_dht : 0) | expected | debug;
+ dht->torrents_max = K;
+ dht->peers_per_torrent_max = K;
struct torrent * torrent = torrent_init();
memcpy(torrent->hash, "\xdd\x82\x55\xec\xdc\x7c\xa5\x5f\xb0\xbb\xf8\x13\x23\xd8\x70\x62\xdb\x1f\x6d\x1c", 20);
torrent->type = /* (useless, since we have no listening system yet) announce | */ peers | info;
@@ -121,8 +137,22 @@ int main (int argc, char ** argv) {
periodic(dht);
// alarm(PERIODIC);
w:
- while (poll(pollfds, nfds, -1) != -1) // can't timeout
+ while (poll(pollfds, nfds, -1) != -1) { // can't timeout
+ if (sigusr1) {
+ sigusr1 = 0;
+ dht_print(stdout, dht);
+ goto w;
+ }
+ if (periodično) {
+ periodično = 0;
+ // alarm(PERIODIC);
+ periodic(dht);
+ goto w;
+ }
+ if (samomor)
+ goto s;
work(dht);
+ }
switch (errno) {
case EINTR:
if (sigusr1) {
@@ -146,6 +176,7 @@ w:
r = 115;
goto r;
}
+ s:
config = persistent(dht);
dht_free(dht);
dht = NULL;
diff --git a/www/index.php b/www/index.php
index bc55638..ac4bb50 100644
--- a/www/index.php
+++ b/www/index.php
@@ -33,7 +33,7 @@ table, td, tr, th {
<table>
<tr>
<th>pridobljeno</th>
- <td><?= date("d. m. Y. H:i:s", $t->getCreationDate()) ?></td>
+ <td><?= date("d. m. Y H:i:s", $t->getCreationDate()) ?></td>
<tr>
<th>tip</th>
<td><?= $t->getProtocol() ?></td>
@@ -59,6 +59,14 @@ table, td, tr, th {
<th>odjemalec vira</th>
<td><?= htmlspecialchars($t->getRootData()["source"]["v"]) ?></td>
<?php } ?>
+ <tr>
+ <th>velikost koščka</th>
+ <td><?= $t->getPieceLength()/1024; ?> kB</td>
+<?php if (!empty($t->getSource())) { ?>
+ <tr>
+ <th>izvor</th>
+ <td><?= htmlspecialchars($t->getSource()) ?></td>
+<?php } ?>
</table>
<?php
function p ($k, $v) {
@@ -76,3 +84,6 @@ foreach ($t->getFileTree() as $k => $v)
p($k, $v);
echo "</ul>";
?>
+<?php if (preg_match("/Development Server/", $_SERVER["SERVER_SOFTWARE"])) { ?>
+<h1 style=color:red>interna stran, dostop prepovedan</h1>
+<?php } ?>