[Twisted-Python] Twisted Conch - Flow control

Matt Freeman matt at nonuby.com
Tue Nov 6 22:49:34 EST 2012


I asked this question on  Stackoverflow (even offered a bounty) and IRC:

http://stackoverflow.com/questions/13117502/twisted-conch-flow-control
--

I have a Twisted Conch SSH server and the typical scenario is this:

git via OpenSSH client >>--- WAN1 --->> Twisted conch svr >>--- WAN2 -->>
Git server

There will be occassions that the 'git push' is sending data faster over
WAN1 than I can proxy it over WAN2, so I need to tell the client to slow
down (well before any TCP packet loss causes adjustments the TCP window
size) to avoid buffering too much on the Twisted server. Reading the RFC
for SSH this is accomplished with not acknowledging via adj window this
will then cause the git push to block on syscall write to the pipe backed
by openssh.

Looking at conch/ssh/connection.py:L216 in the method def
ssh_CHANNEL_DATA(self, packet): I can accomplish this with setting
localWindowSize to 0, and inflight data will still land as the predicate on
230 should still pass (give localWindowLeft). I am wondering if this is the
correct approach or am I missing something blindly obvious with regards to
flow control with Twisted SSH Conch? *

Note: I acknowledge there are methods placeholders for stopWriting and
startWriting on (channel) that I can override so I have hooks to control
the other side of the transmission 'git pull', but Im interested in first
leg. Also IPush/IPull producer dont seem applicable at this level and I
cant see how I can tie in these higher abstraction without butchering
conch?
-- 
Matt Freeman - @nonuby - http://blog.nonuby.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20121107/1b88b887/attachment.htm 


More information about the Twisted-Python mailing list