add_callbacks function in p2p; fix #186