On Dec 18, 2013, at 5:43 AM, Antoine Pitrou <[email protected]> wrote:
>> If you need to do something in connection_lost anyway, then why not just
>> call create_connection again yourself?
>
> Because you don't know the connection parameters from inside the
> protocol. It's irrational to ask the protocol to know about the
> connection parameters when the whole point of protocols is to be
> decoupled from transport and connection characteristics.
But, as you've said, the protocol needs to examine the reasons for
disconnection anyway, and different disconnection reasons may result in
different connection parameters. And as I explained previously, even if you
have *some* information about your current transport, there's information about
how to re-create that transport ("connection parameters", as you say) which can
vary by protocol even if the transport itself remembers everything.
So if you have a protocol that needs to know how to re-establish its
connection, just write a protocol that knows what "re-establish" means.
-glyph