aDTN.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:aDTN-python 作者: megfault 项目源码 文件源码
def stop(self):
        """
        Stop aDTN. Make sure the two threads created at start are finished properly.
        """
        self._sending = False
        try:
            while not self._scheduler.empty():
                event = self._scheduler.queue.pop()
                self._scheduler.cancel(event)
            # By now the scheduler has run empty, so join the thread:
            self._thread_send.join()
            sleep(5)
            # Now we just have to join the receiving thread to stop aDTN completely:
            self._sniffing = False
            self._thread_receive.join()
            log_network("stop")
        except ValueError:  # In case the popped event started running in the meantime...
            log_debug("Scheduler is not empty, retry stopping.")
            self.stop()  # ...call the stop function once more.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号