[Twisted-Python] SSH Forwading and Database Queries in same application

I am trying to use twisted.conch.ssh to write an application that first sets up an ssh connection that forwards port 5432 from an external server to my local machine and then locally connect to a database running on the server using that port. I am able to write two separate applications that accomplish what I want, but I am unable to integrate them into one. Using the two application approach, I can first start the application that sets up my port forwarding and then start the application that connects to my database. I can then make queries using the second application and everything seems to work just fine. When integrating them into one application I am still able to connect to the database, but I cannot run any queries over it. The queries hang indefinitely, and neither my callback nor my errback functions that should run after the query has completed ever get called. My setup for implementing this is as follows.... I have introduced a deferred when setting up my port forwarding that gets its callback only once the startFactory() event gets called for my class derived from forwarding.SSHListenForwardingFactory. The forwarding is setup using the following code snippet..... reactor.listenTCP(PORT, DatabaseForwardingFactory(self.conn, (LOCALHOST, PORT), DatabaseClientForwardingChannel)) where.... class DatabaseForwardingFactory(forwarding.SSHListenForwardingFactory): class DatabaseClientForwardingChannel( forwarding.SSHListenClientForwardingChannel): Does anyone have any idea why this might not be working? I tried deferring my query to a thread to see if this would help matters, but to no avail. Any help at all would be appreciated.
participants (1)
-
Kevin Klues