404

[ Avaa Bypassed ]




Upload:

Command:

botdev@3.145.82.96: ~ $
# -*- test-case-name: twisted.conch.test.test_mixin -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
Experimental optimization

This module provides a single mixin class which allows protocols to
collapse numerous small writes into a single larger one.

@author: Jp Calderone
"""

from twisted.internet import reactor

class BufferingMixin:
    """
    Mixin which adds write buffering.
    """
    _delayedWriteCall = None
    data = None

    DELAY = 0.0

    def schedule(self):
        return reactor.callLater(self.DELAY, self.flush)


    def reschedule(self, token):
        token.reset(self.DELAY)


    def write(self, data):
        """
        Buffer some bytes to be written soon.

        Every call to this function delays the real write by C{self.DELAY}
        seconds.  When the delay expires, all collected bytes are written
        to the underlying transport using L{ITransport.writeSequence}.
        """
        if self._delayedWriteCall is None:
            self.data = []
            self._delayedWriteCall = self.schedule()
        else:
            self.reschedule(self._delayedWriteCall)
        self.data.append(data)


    def flush(self):
        """
        Flush the buffer immediately.
        """
        self._delayedWriteCall = None
        self.transport.writeSequence(self.data)
        self.data = None

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
client Folder 0755
insults Folder 0755
openssh_compat Folder 0755
scripts Folder 0755
ssh Folder 0755
test Folder 0755
ui Folder 0755
__init__.py File 515 B 0644
avatar.py File 1.4 KB 0644
checkers.py File 19.28 KB 0644
endpoints.py File 28.33 KB 0644
error.py File 2.65 KB 0644
interfaces.py File 12.76 KB 0644
ls.py File 2.49 KB 0644
manhole.py File 11.3 KB 0644
manhole_ssh.py File 3.9 KB 0644
manhole_tap.py File 5.24 KB 0644
mixin.py File 1.34 KB 0644
recvline.py File 11.25 KB 0644
stdio.py File 2.71 KB 0644
tap.py File 3.11 KB 0644
telnet.py File 37.64 KB 0644
ttymodes.py File 2.19 KB 0644
unix.py File 15.91 KB 0644