コード例 #1
0
class AuthorizationProxy(SocketServer.ThreadingUnixStreamServer):
    def __init__(self, listening_sock, db_path, upstream_sock):
        # XXX BaseServer is an old style class, so we need to explicitly call
        # our parents initializer
        SocketServer.ThreadingUnixStreamServer. \
            __init__(self, listening_sock, AgentProxyRequestHandler)

        self.authorizer = Authorizer(db_path)

        # Shared request queue
        request_queue = Queue.Queue(100)
        # Start first consumer thread
        self.agent = UpstreamSocketThread(upstream_sock, queue=request_queue)
        self.agent.start()
        # Start two additional consumer threads
        for i in range(2):
            UpstreamSocketThread(upstream_sock, queue=request_queue).start()
コード例 #2
0
class AuthorizationProxy(SocketServer.ThreadingUnixStreamServer):
    def __init__(self, listening_sock, db_path, upstream_sock):
        # XXX BaseServer is an old style class, so we need to explicitly call
        # our parents initializer
        SocketServer.ThreadingUnixStreamServer. \
            __init__(self, listening_sock, AgentProxyRequestHandler)

        self.authorizer = Authorizer(db_path)

        # Shared request queue
        request_queue = Queue.Queue(100)
        # Start first consumer thread
        self.agent = UpstreamSocketThread(upstream_sock, queue=request_queue)
        self.agent.start()
        # Start two additional consumer threads
        for i in range(2):
            UpstreamSocketThread(upstream_sock, queue=request_queue).start()
コード例 #3
0
class AgentMultiplexer(SocketServer.ThreadingUnixStreamServer):
    timeout = 3

    def __init__(self, listening_sock, default_agent_sock,
                 alternate_agent_sock):
        # XXX BaseServer is an old style class, so we need to explicitly call
        # our parents initializer
        SocketServer.ThreadingUnixStreamServer.__init__(
            self, listening_sock, AgentMultiplexerRequestHandler)

        self.default_agent = UpstreamSocketThread(default_agent_sock)
        self.default_agent.start()
        self.alternate_agent = UpstreamSocketThread(alternate_agent_sock)
        self.alternate_agent.start()

    def agents(self):
        yield self.default_agent
        yield self.alternate_agent
コード例 #4
0
ファイル: ssh_agent_mux.py プロジェクト: zsais/sshagentmux
class AgentMultiplexer(SocketServer.ThreadingUnixStreamServer):
    timeout = 3

    def __init__(self, listening_sock, default_agent_sock,
                 alternate_agent_sock):
        # XXX BaseServer is an old style class, so we need to explicitly call
        # our parents initializer
        SocketServer.ThreadingUnixStreamServer.__init__(
            self, listening_sock, AgentMultiplexerRequestHandler)

        self.default_agent = UpstreamSocketThread(default_agent_sock)
        self.default_agent.start()
        self.alternate_agent = UpstreamSocketThread(alternate_agent_sock)
        self.alternate_agent.start()

    def agents(self):
        yield self.default_agent
        yield self.alternate_agent