[Twisted-Python] Supporting a two-part client protocol.

Colin Dunklau colin.dunklau at gmail.com
Wed Feb 5 01:48:41 MST 2020


On Tue, Feb 4, 2020 at 6:12 PM Go Luhng <goluhng at gmail.com> wrote:
>
> Thanks Colin and Barry for the reply. I read the sans-io docs and it
> is an attractive approach.
>
> I believe I have a plan going forward, but I'm not sure what you mean
> by explicit vs implicit state machine, if you care to elaborate.

I realize now that in my previous reply I conflated state machine with
parser state. Sorry about that!

Neither IntNStringReceiver nor LineOnlyReceiver has much in the way of
state. LineReceiver does, but it's a simple flag (line or raw mode).
conch.ssh's SSHTransportBase has more:
https://github.com/twisted/twisted/blob/twisted-19.10.0/src/twisted/conch/ssh/transport.py#L456-L471
This is reasonably explicit. It's still mixed in with the protocol
methods, but the states are at least explicitly declared.

I wasn't able to find an example in Twisted of an implicit state
machine. Maybe someone else has a concrete example somewhere?



More information about the Twisted-Python mailing list