On Wed, 18 Dec 2013 20:02:48 -0800 Glyph <[email protected]> wrote: > 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.
Uh, no. The protocol needs to decide *whether* to reconnect, it certainly shouldn't know *how* to reconnect (other than say `self.transport.reconnect()`). Otherwise the protocol / transport abstraction barrier is broken. Regards Antoine.
