python类serverFromString()的实例源码

test_client.py 文件源码 项目:txacme 作者: twisted 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _create_responder(self):
        action = start_action(action_type=u'integration:create_responder')
        with action.context():
            responder = TLSSNI01Responder()
            host_map = responder.wrap_host_map({})
            site = Site(Resource())
            endpoint = TLSEndpoint(
                endpoint=serverFromString(reactor, self.ENDPOINT),
                contextFactory=SNIMap(host_map))
            return (
                DeferredContext(endpoint.listen(site))
                .addCallback(lambda port: self.addCleanup(port.stopListening))
                .addCallback(lambda _: responder)
                .addActionFinish())
__init__.py 文件源码 项目:matrix-synapse-ldap3 作者: matrix-org 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def create_ldap_server():
    "Returns a context manager that represents the LDAP server."

    db = yield _create_db()
    factory = _LDAPServerFactory(db)
    factory.debug = True

    # We just pick an arbitrary port to listen on.
    serverEndpointStr = "tcp:0"
    e = serverFromString(reactor, serverEndpointStr)
    listener = yield e.listen(factory)

    defer.returnValue(_LdapServer(listener))


问题


面经


文章

微信
公众号

扫码关注公众号