Scherbina, Alexander (ASCHERBI)
ASCHERBI at arinc.com
Tue Oct 29 19:00:27 EST 2002
I have a server that queues messages for clients. The Queue object has a
callback from the ConnectionFactory, which deals with output formatting and
holds the Protocol object. As soon as a client connects, the
ConnectionFactory peeks in the Queue for messages to be sent. And if there
are any, it will send and dequeue and peek again until the Queue is
exhausted. Once it's exhausted, the ConnectionFactory will be called
(using the callback) by the Queue when the next message is enqueued by the
So far, this mechanism works well. But one of its flaws is the partial
write situation. If output buffer overflow occurred, I would like to
continue doing other things and get called back by the Reactor when the
socket is writable again. Moreover, I would like to break the direct
association between the Queue and the ConnectionFactory.
Instead, I would like to tie them through some kind of a notification
strategy (like in ACE), where my ConnectionFactory would be notifed by the
Reactor when the socket is writable, then the ConnectionFactory could peek,
send, dequeue and wait for the next notification.
I thought, addWriter/doWrite is what I need to use. When I used them, my
ConnectionFactory's doWrite was never called after a client connected.
Is addWriter/doWrite approach correct? Or am I going in a totally wrong
direction? Please, help, if you can.
More information about the Twisted-Python