return saslc transport = TSaslClientTransport(sasl_factory, conf.mechanism, mode) elif conf.transport == 'framed': transport = TFramedTransport(mode) else: transport = TBufferedTransport(mode) protocol = TBinaryProtocol(transport) if conf.multiple: protocol = TMultiplexedProtocol(protocol, conf.service_name) service = conf.klass(protocol) return service, protocol, transport _connection_pool = ConnectionPooler(poolsize=CHERRYPY_SERVER_THREADS.get()) def get_client(klass, host, port, service_name, **kwargs): conf = ConnectionConfig(klass, host, port, service_name, **kwargs) return PooledClient(conf) def _grab_transport_from_wrapper(outer_transport): if isinstance(outer_transport, TBufferedTransport): return outer_transport._TBufferedTransport__trans elif isinstance(outer_transport, TSaslClientTransport): return outer_transport._trans elif isinstance(outer_transport, TFramedTransport): return outer_transport._TFramedTransport__trans else:
saslc.init() return saslc transport = TSaslClientTransport(sasl_factory, conf.mechanism, mode) elif conf.transport == 'framed': transport = TFramedTransport(mode) else: transport = TBufferedTransport(mode) protocol = TBinaryProtocol(transport) if conf.multiple: protocol = TMultiplexedProtocol(protocol, conf.service_name) service = conf.klass(protocol) return service, protocol, transport _connection_pool = ConnectionPooler(poolsize=CHERRYPY_SERVER_THREADS.get()) def get_client(klass, host, port, service_name, **kwargs): conf = ConnectionConfig(klass, host, port, service_name, **kwargs) return PooledClient(conf) def _grab_transport_from_wrapper(outer_transport): if isinstance(outer_transport, TBufferedTransport): return outer_transport._TBufferedTransport__trans elif isinstance(outer_transport, TSaslClientTransport): return outer_transport._trans elif isinstance(outer_transport, TFramedTransport): return outer_transport._TFramedTransport__trans else: raise Exception("Unknown transport type: " + outer_transport.__class__)