[Zope-CVS] CVS: Packages/SFTPGateway/src/sftpgateway -
connector.py:1.38
Fred L. Drake, Jr.
fred at zope.com
Mon Dec 22 15:09:56 EST 2003
Update of /cvs-repository/Packages/SFTPGateway/src/sftpgateway
In directory cvs.zope.org:/tmp/cvs-serv4055
Modified Files:
connector.py
Log Message:
don't cause clients to hang if there are weird problems when
connecting to the server (in particular, when a proxy is used by the
actual server is down, the control connection can be immediately
closed; this was not properly detected)
=== Packages/SFTPGateway/src/sftpgateway/connector.py 1.37 => 1.38 ===
--- Packages/SFTPGateway/src/sftpgateway/connector.py:1.37 Mon Dec 22 14:14:19 2003
+++ Packages/SFTPGateway/src/sftpgateway/connector.py Mon Dec 22 15:09:56 2003
@@ -21,7 +21,7 @@
from twisted.conch.ssh import filetransfer
from twisted.conch.ssh.filetransfer import SFTPError
from twisted.internet import defer, protocol, reactor
-from twisted.internet.error import ConnectionRefusedError
+from twisted.internet.error import ConnectionDone, ConnectionRefusedError
from twisted.protocols import basic, ftp
from twisted.python import failure
@@ -64,6 +64,9 @@
self._logger.debug("lost FTP connection: %s", error.args[0][0])
return ftp.FTPClient.fail(self, error)
+ def connectionLost(self, reason):
+ self.fail(ConnectionDone(["connection lost"]))
+ return ftp.FTPClient.connectionLost(self, reason)
class FileTransferServerPatch(filetransfer.FileTransferServer):
@@ -121,7 +124,8 @@
message = ("could not create FTP client: "
"connection refused")
self._app.debug(message)
- raise SFTPError(filetransfer.FX_FAILURE, message)
+ return failure.Failure(
+ SFTPError(filetransfer.FX_FAILURE, message))
creator = protocol.ClientCreator(reactor, MyFTPClient, self)
d = creator.connectTCP(self._host, self._port)
d.addCallbacks(callback, errback)
More information about the Zope-CVS
mailing list