remote.py 文件源码

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

项目:SameKeyProxy 作者: xzhou 项目源码 文件源码
def handle_requests(wait_time = None, callback = None):
    global abort

    abort = false

    if pyro_daemon is None:
        raise Error("There is no daemon with which to handle requests")

    if wait_time:
        start = time.time()

    while not abort:
        try:
            pyro_daemon.handleRequests(wait_time)

            if wait_time:
                now = time.time()
                if callback and now - start > wait_time:
                    callback()
                    start = now
            elif callback:
                callback()

        # ignore socket and select errors, they are often transient
        except socket.error: pass
        except Exception, msg:
            if verbose:
                print "Error:", sys.exc_type, msg
            abort = true
        except:
            abort = true

    return abort
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号