[Twisted-Python] SSL4ClientEndpoint not updating the transport's connected flag on connection lost

Adi Roiban adi at roiban.ro
Thu Aug 11 07:59:12 MDT 2016


Hi,

I have observed that when a SSL4ClientEndpoint was used, the
protocol's transport `connected` attribute is not updated by the
wrapper when the connection is lost.

I have this code which will need your own server cert+key file:

https://gist.github.com/adiroiban/8e0be840f81750f88a587e634ddfb194

I tried it on twisted/trunk and when SSL is used the output is

server:client connected
client:connected
client:send-message
server:data received
client:connection-lost
client:transport-status:1:wrapped-transport->0
server:client disconnected
client:transport-status:1:wrapped-transport->0

while without SSL the output is:

server:client connected
client:connected
client:send-message
server:data received
server:client disconnected
client:connection-lost
client:transport-status:0:wrapped-transport->0
client:transport-status:0:wrapped-transport->0

------------

My current finding is that the reactor will call connection lost on
t.i.abstract.FileDescriptor.connectionLost and not on
t.protocols.policies.ProtocolWrapper

so it seems that when SSL is used the wrapped protocol is registered
instead of the wrapping protocol.

------

I am doing something wrong here?

Is this the expected behavior or this is a bug?

Thanks!

-- 
Adi Roiban



More information about the Twisted-Python mailing list