Ticket #5562: #5562_abstract_2.py.patch

File #5562_abstract_2.py.patch, 1.3 KB (added by dynamicgl, 2 years ago)
  • twisted/internet/iocpreactor/abstract.py

     
    152152    _writeDisconnecting = False 
    153153    _writeDisconnected = False 
    154154    writeBufferSize = 2**2**2**2 
     155    _doWriteCalling = False 
    155156 
    156157 
    157158    def loseWriteConnection(self): 
     
    182183            self._writeScheduled.cancel() 
    183184            self._writeScheduled = None 
    184185        self.writing = False 
     186        self._doWriteCalling = False 
    185187 
    186188 
    187189    def _resumeWriting(self): 
    188190        self._writeScheduled = None 
    189         self.doWrite() 
     191        if self.writing: 
     192            if self._doWriteCalling: 
     193                self.reactor.callLater(0, self._resumeWriting) 
     194            else: 
     195                self.doWrite() 
    190196 
    191197 
    192198    def _cbWrite(self, rc, bytes, evt): 
     199        self._doWriteCalling = False 
    193200        if self._handleWrite(rc, bytes, evt): 
    194201            self.doWrite() 
    195202 
     
    235242 
    236243 
    237244    def doWrite(self): 
     245        self._doWriteCalling = True 
    238246        if len(self.dataBuffer) - self.offset < self.SEND_LIMIT: 
    239247            # If there is currently less than SEND_LIMIT bytes left to send 
    240248            # in the string, extend it with the array data.