~divmod-dev/divmod.org/trunk

« back to all changes in this revision

Viewing changes to Epsilon/epsilon/hotfixes/loopbackasync_reentrancy.py

  • Committer: Jean-Paul Calderone
  • Date: 2014-06-29 20:33:04 UTC
  • mfrom: (2749.1.1 remove-epsilon-1325289)
  • Revision ID: exarkun@twistedmatrix.com-20140629203304-gdkmbwl1suei4m97
mergeĀ lp:~exarkun/divmod.org/remove-epsilon-1325289

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
"""
3
 
Fix from Twisted r23970
4
 
"""
5
 
 
6
 
from twisted.internet.task import deferLater
7
 
from twisted.protocols.loopback import _loopbackAsyncBody
8
 
 
9
 
def _loopbackAsyncContinue(ignored, server, serverToClient, client, clientToServer):
10
 
    # Clear the Deferred from each message queue, since it has already fired
11
 
    # and cannot be used again.
12
 
    clientToServer._notificationDeferred = serverToClient._notificationDeferred = None
13
 
 
14
 
    # Schedule some more byte-pushing to happen.  This isn't done
15
 
    # synchronously because no actual transport can re-enter dataReceived as
16
 
    # a result of calling write, and doing this synchronously could result  
17
 
    # in that.
18
 
    from twisted.internet import reactor
19
 
    return deferLater(
20
 
        reactor, 0,   
21
 
        _loopbackAsyncBody, server, serverToClient, client, clientToServer)
22
 
 
23
 
 
24
 
def install():
25
 
    from twisted.protocols import loopback
26
 
    loopback._loopbackAsyncContinue = _loopbackAsyncContinue