ó [³XMc@seddlmZyddlmZWn!ek rGddlmZnXdejfd„ƒYZdS(iÿÿÿÿ(tprotocol(tStringIOtStatefulProtocolcBs/eZdZdZd„Zd„Zd„ZRS(s-A Protocol that stores state for you. state is a pair (function, num_bytes). When num_bytes bytes of data arrives from the network, function is called. It is expected to return the next state or None to keep same state. Initial state is returned by getInitialState (override it). icCs2tjj||ƒ|jƒtƒdf|_dS(Ni(RtProtocoltmakeConnectiontgetInitialStateRt _sful_data(tselft transport((s>/usr/lib/python2.7/dist-packages/twisted/protocols/stateful.pyRscCs t‚dS(N(tNotImplementedError(R((s>/usr/lib/python2.7/dist-packages/twisted/protocols/stateful.pyRsc Cs|j\}}}|jddƒ|j|ƒ|jƒ}|j|ƒxh|||dkr²|j|dƒ}||d7}|d|ƒ}|jjr dS|rK|}qKqKW|dkrø|jƒ}|jdƒ|jƒ|j|ƒd}n|||f|_dS(Niii(RtseektwritettelltreadRt disconnectingttruncate( Rtdatatstatetbuffertoffsettblentdtnexttb((s>/usr/lib/python2.7/dist-packages/twisted/protocols/stateful.pyt dataReceiveds(           N(NNi(t__name__t __module__t__doc__tNoneRRRR(((s>/usr/lib/python2.7/dist-packages/twisted/protocols/stateful.pyRs   N(ttwisted.internetRt cStringIORt ImportErrorRR(((s>/usr/lib/python2.7/dist-packages/twisted/protocols/stateful.pyts