Transmission has already merged dht-0.22
remove unnecessary header includes
fix possible bug on certain systems
add headers and guards to make cygwin happy