summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--paramiko/agent.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/paramiko/agent.py b/paramiko/agent.py
index 4b562f78..3405a3de 100644
--- a/paramiko/agent.py
+++ b/paramiko/agent.py
@@ -27,8 +27,8 @@ import sys
import threading
import tempfile
import stat
-import select
import fcntl
+from select import select
from paramiko.ssh_exception import SSHException
from paramiko.message import Message
@@ -117,22 +117,18 @@ class AgentProxyThread(threading.Thread):
raise
def _communicate(self):
- p = select.poll()
oldflags = fcntl.fcntl(self.__inr, fcntl.F_GETFL)
fcntl.fcntl(self.__inr, fcntl.F_SETFL, oldflags | os.O_NONBLOCK)
- p.register(self._agent._conn, select.POLLIN)
- p.register(self.__inr, select.POLLIN)
while not self._exit:
- c = p.poll(500)
- for cc in c:
- fd, event = cc
- if self._agent._conn.fileno() == fd:
+ events = select([self._agent._conn, self.__inr], [], [], 0.5)
+ for fd in events[0]:
+ if self._agent._conn == fd:
data = self._agent._conn.recv(512)
if len(data) != 0:
self.__inr.send(data)
else:
break
- elif self.__inr.fileno() == fd:
+ elif self.__inr == fd:
data = self.__inr.recv(512)
if len(data) != 0:
self._agent._conn.send(data)