[Twisted-Python] Correct pattern to do SSH forwarding in a GUI
Luper Rouch
luper.rouch at gmail.com
Mon Feb 16 23:19:21 EST 2009
I am using twisted in a GUI application to do port forwarding over an
SSH connection. All the network connections of the application
(database, etc...) are routed through this connection, to simplify
server configuration and secure things.
My first attempt was to run the reactor in the main thread, but the
application was "freezing" when e.g. doing a SELECT with
SQLAlchemy/psycopg2 (I guess because psycopg2 just waits for data and
blocks the twisted reactor). So I put reactor.run() in a thread and it
works, but I'm getting strange issues on some platforms (for example I
can't connect at all on *some* OSX computers, getting a "reactor
stopping" log from twisted without any further error), and I feel I'm
doing the whole thing terribly wrong.
So my question is, how to do proper SSH port forwarding with conch in an
application that also uses the tunnels not the asynchronous way ? If
running the reactor in a thread is OK, are there particular things to
watch out for ?
More information about the Twisted-Python
mailing list