def shutdown(self):
        # Cancel all dcalls
        dcall_discard(self, 'initrequest_dcall')
        dcall_discard(self, 'finish_dcall')

        for p in self.peers.values():
            dcall_discard(p, 'timeout_dcall')

        # Close socket
        if self.transport:
            self.transport.stopListening()