On Mon, Oct 22, 2012 at 12:06 PM, Glyph <gl...@twistedmatrix.com> wrote:
> > On Oct 20, 2012, at 7:56 PM, gelin yan <dynami...@gmail.com> wrote: > > "A pending operation is indicated when the function that started the > operation returns *FALSE*, and the > *GetLastError*<http://msdn.microsoft.com/en-us/library/windows/desktop/ms679360(v=vs.85).aspx> > function > returns *ERROR_IO_PENDING*. When an I/O operation is pending, the > function that started the operation resets the *hEvent* member of the * > OVERLAPPED* structure to the nonsignaled state. Then when the pending > operation has been completed, the system sets the event object to the > signaled state." > > If we can know when event object is in the signaled state we definitely > can use a queue directly. Any idea? > > > Sounds like you're at the point where you should just try doing an > implementation, and if it works and passes all the tests you can think of > for it, submit it for code review. Much more speculation without testing > wouldn't be useful. > > Thanks for working on this! > > -glyph > > _______________________________________________ > Twisted-Python mailing list > Twisted-Python@twistedmatrix.com > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python > > Hi All Sorry for coming late. The day before yesterday, I dig out what happen in that code. Actually, ERROR_IO_PENDING isn't the root of problem. The problem is doWrite method might be triggered twice instead of once; in particular, when trying to send a large chunks data whose size is bigger then SEND_LIMIT, it will always happen. When doWrite being invoked twice, it means the same buffer data will be sent twice. It is for sure that PB is unable to deserialize these data and finally it raise an exception, now, we can see connection lost. The solution is to make sure doWrite calling in order; hence I introduce a new field named _doWriteCalling to detect whether doWrite call is completed. (due to doWrite always post an event to IOCP, so once _cbWrite get called, it means we can schedule another doWrite). If _cbWrite isn't called, we simply re-schedule the doWrite by reactor.callLater. I attach a modified abstract.py here. You may put it in Path\twisted\internet\iocpreactor and give it a try. Regards gelin yan
abstract.py
Description: Binary data
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python