diff --git a/paramiko/__init__.py b/paramiko/__init__.py index 08384d9..653825e 100644 --- a/paramiko/__init__.py +++ b/paramiko/__init__.py @@ -103,6 +103,8 @@ from common import AUTH_SUCCESSFUL, AUTH_PARTIALLY_SUCCESSFUL, AUTH_FAILED, \ from sftp import SFTP_OK, SFTP_EOF, SFTP_NO_SUCH_FILE, SFTP_PERMISSION_DENIED, SFTP_FAILURE, \ SFTP_BAD_MESSAGE, SFTP_NO_CONNECTION, SFTP_CONNECTION_LOST, SFTP_OP_UNSUPPORTED +from common import io_sleep + __all__ = [ 'Transport', 'SSHClient', 'MissingHostKeyPolicy', @@ -136,4 +138,5 @@ __all__ = [ 'Transport', 'AgentKey', 'HostKeys', 'SSHConfig', - 'util' ] + 'util', + 'io_sleep' ] diff --git a/paramiko/agent.py b/paramiko/agent.py index 6a5407d..66fe214 100644 --- a/paramiko/agent.py +++ b/paramiko/agent.py @@ -34,6 +34,7 @@ from paramiko.ssh_exception import SSHException from paramiko.message import Message from paramiko.pkey import PKey from paramiko.channel import Channel +from paramiko.common import io_sleep SSH2_AGENTC_REQUEST_IDENTITIES, SSH2_AGENT_IDENTITIES_ANSWER, \ SSH2_AGENTC_SIGN_REQUEST, SSH2_AGENT_SIGN_RESPONSE = range(11, 15) @@ -134,6 +135,7 @@ class AgentProxyThread(threading.Thread): self._agent._conn.send(data) else: break + time.sleep(io_sleep) class AgentLocalProxy(AgentProxyThread): """ diff --git a/paramiko/common.py b/paramiko/common.py index 3323f0a..25d5457 100644 --- a/paramiko/common.py +++ b/paramiko/common.py @@ -124,3 +124,6 @@ INFO = logging.INFO WARNING = logging.WARNING ERROR = logging.ERROR CRITICAL = logging.CRITICAL + +# Common IO/select/etc sleep period, in seconds +io_sleep = 0.01