'Called by any thread'

def set_state_callback(self, usercallback, getpeerlist=False):

    with self.dllock:
        reactor.callFromThread((lambda : self.network_get_state(usercallback, getpeerlist)))
