merge some cleanup and fixes from libtorrent_aio

git-svn-id: https://svn.code.sf.net/p/libtorrent/code/trunk@9146 a83610d8-ad2a-0410-a6ab-fc0612d85776