o ¯b]ã@s"dZddlmZGdd„dƒZdS)z° 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 é)Úreactorc@s<eZdZdZdZdZdZdd„Zdd„Zdd „Z d d „Z dS) ÚBufferingMixinz+ Mixin which adds write buffering. NgcCst |j|j¡S©N)rÚ callLaterÚDELAYÚflush©Úself©r ú5/usr/lib/python3/dist-packages/twisted/conch/mixin.pyÚscheduleózBufferingMixin.schedulecCs| |j¡dSr)Úresetr)r Útokenr r r Ú rescheduler zBufferingMixin.reschedulecCs8|jdurg|_| ¡|_n| |j¡|j |¡dS)a 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}. N)Ú_delayedWriteCallÚdatar rÚappend)r rr r r Úwrite!s   zBufferingMixin.writecCsd|_|j |j¡d|_dS)z/ Flush the buffer immediately. N)rÚ transportÚ writeSequencerrr r r r0s zBufferingMixin.flush) Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrr rrrr r r r rs rN)rÚtwisted.internetrrr r r r Ús