Add debugging for threaded p2p code