Add IO sleep to agent forward communications.
Without this, use of agent forwarding causes high CPU usage on some clients.
This commit is contained in:
parent
543651bfd2
commit
3030589aaa
|
@ -98,6 +98,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',
|
||||
|
@ -131,4 +133,5 @@ __all__ = [ 'Transport',
|
|||
'AgentKey',
|
||||
'HostKeys',
|
||||
'SSHConfig',
|
||||
'util' ]
|
||||
'util',
|
||||
'io_sleep' ]
|
||||
|
|
|
@ -34,6 +34,7 @@ from ssh.ssh_exception import SSHException
|
|||
from ssh.message import Message
|
||||
from ssh.pkey import PKey
|
||||
from ssh.channel import Channel
|
||||
from ssh.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):
|
||||
"""
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue