[Twisted-Python] How to be sure a ssl connection was completed correctly
itamar at itamarst.org
Mon Jan 23 09:00:42 EST 2012
On 01/23/2012 08:46 AM, Hanusz L. wrote:
> I'm using the pull method to send events to clients (with xmlrpc over ssl).
> The events are in a queue and when a client calls my 'get_event' xmlrpc function; I get one event from the queue and send it to the client.
> The problem is that I want to be sure that the client receives all the events.
> Is it correct to assume that:
> IF the method connectionLost of my protocol (the wrapped protocol of the ssl protocol) is called with a failure(error.ConnectionDone())
> THEN the connection was completed successfully and the client received the event correctly ?
No, that just means the SSL disconnect and then the TCP disconnect
handshakes were done cleanly. That may happen for reasons other than
queue being cleared, e.g. the server decided to shutdown for some reason.
You need to have some other way of knowing if queue is empty, e.g. way
to query queue size (and knowledge that no one else will add to queue
after you queried it).
More information about the Twisted-Python