Ejemplo n.º 1
0
 def writemessage(self, text):
     """Put data in output queue, rebuild the prompt and entered data"""
     # Need to grab the input queue lock to ensure the entered data doesn't change
     # before we're done rebuilding it.
     # Note that writemessage will eventually call writecooked
     self.IQUEUELOCK.acquire()
     TelnetHandlerBase.writemessage(self, text)
     self.IQUEUELOCK.release()
Ejemplo n.º 2
0
 def writemessage(self, text):
     """Put data in output queue, rebuild the prompt and entered data"""
     # Need to grab the input queue lock to ensure the entered data doesn't change
     # before we're done rebuilding it.
     # Note that writemessage will eventually call writecooked
     self.IQUEUELOCK.acquire()
     TelnetHandlerBase.writemessage(self, text)
     self.IQUEUELOCK.release()
Ejemplo n.º 3
0
    def setup(self):
        '''Called after instantiation'''
        TelnetHandlerBase.setup(self)
        # Spawn a greenlet to handle socket input
        self.greenlet_ic = gevent.spawn(self.inputcooker)
        # Note that inputcooker exits on EOF

        # Sleep for 0.5 second to allow options negotiation
        gevent.sleep(0.5)
Ejemplo n.º 4
0
    def setup(self):
        '''Called after instantiation'''
        TelnetHandlerBase.setup(self)
        # Spawn a greenlet to handle socket input
        self.greenlet_ic = eventlet.spawn(self.inputcooker)
        # Note that inputcooker exits on EOF

        # Sleep for 0.5 second to allow options negotiation
        eventlet.sleep(0.5)
Ejemplo n.º 5
0
    def __init__(self, request, client_address, server):
        # This is the cooked input stream (list of charcodes)
        self.cookedq = []   

        # Create the locks for handing the input/output queues
        self.IQUEUELOCK = threading.Lock()
        self.OQUEUELOCK = threading.Lock()

        # Call the base class init method
        TelnetHandlerBase.__init__(self, request, client_address, server)
Ejemplo n.º 6
0
    def __init__(self, request, client_address, server):
        # This is the cooked input stream (list of charcodes)
        self.cookedq = []

        # Create the locks for handing the input/output queues
        self.IQUEUELOCK = threading.Lock()
        self.OQUEUELOCK = threading.Lock()

        # Call the base class init method
        TelnetHandlerBase.__init__(self, request, client_address, server)
Ejemplo n.º 7
0
 def setup(self):
     '''Called after instantiation'''
     TelnetHandlerBase.setup(self)
     # Spawn a thread to handle socket input
     self.thread_ic = threading.Thread(target=self.inputcooker)
     self.thread_ic.setDaemon(True)
     self.thread_ic.start()
     # Note that inputcooker exits on EOF
     
     # Sleep for 0.5 second to allow options negotiation
     time.sleep(0.5)
Ejemplo n.º 8
0
    def setup(self):
        '''Called after instantiation'''
        TelnetHandlerBase.setup(self)
        # Spawn a thread to handle socket input
        self.thread_ic = threading.Thread(target=self.inputcooker)
        self.thread_ic.setDaemon(True)
        self.thread_ic.start()
        # Note that inputcooker exits on EOF

        # Sleep for 0.5 second to allow options negotiation
        time.sleep(0.5)
Ejemplo n.º 9
0
 def writecooked(self, text):
     """Put data directly into the output queue"""
     # Ensure this is the only thread writing
     self.OQUEUELOCK.acquire()
     TelnetHandlerBase.writecooked(self, text)
     self.OQUEUELOCK.release()
Ejemplo n.º 10
0
 def finish(self):
     '''Called as the session is ending'''
     TelnetHandlerBase.finish(self)
Ejemplo n.º 11
0
 def finish(self):
     '''Called as the session is ending'''
     TelnetHandlerBase.finish(self)
     # Ensure the greenlet is dead
     gevent.kill(self.greenlet_ic)
Ejemplo n.º 12
0
 def __init__(self, request, client_address, server):
     # Create a green queue for input handling
     self.cookedq = gevent.queue.Queue()
     # Call the base class init method
     TelnetHandlerBase.__init__(self, request, client_address, server)
Ejemplo n.º 13
0
 def __init__(self, request, client_address, server):
     # Create a green queue for input handling
     self.cookedq = eventlet.queue.Queue()
     # Call the base class init method
     TelnetHandlerBase.__init__(self, request, client_address, server)
Ejemplo n.º 14
0
 def finish(self):
     '''Called as the session is ending'''
     TelnetHandlerBase.finish(self)
     # Ensure the greenlet is dead
     self.greenlet_ic.kill()
Ejemplo n.º 15
0
 def writecooked(self, text):
     """Put data directly into the output queue"""
     # Ensure this is the only thread writing
     self.OQUEUELOCK.acquire()
     TelnetHandlerBase.writecooked(self, text)
     self.OQUEUELOCK.release()
Ejemplo n.º 16
0
 def finish(self):
     '''Called as the session is ending'''
     TelnetHandlerBase.finish(self)