使用原生select

pull/26/head
ibuler 2015-11-06 12:09:23 +08:00
parent 01d6f751b1
commit 43c0770770
1 changed files with 14 additions and 11 deletions

View File

@ -21,7 +21,8 @@ from pyinotify import WatchManager, Notifier, ProcessEvent, IN_DELETE, IN_CREATE
# from gevent import monkey
# monkey.patch_all()
# import gevent
from gevent.socket import wait_read, wait_write
# from gevent.socket import wait_read, wait_write
import struct, fcntl, signal, socket, select, fnmatch
import paramiko
@ -200,8 +201,10 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
try:
data = ''
while True:
wait_read(self.chan.fileno())
r, w, e = select.select([self.chan, sys.stdin], [], [])
if self.chan in r:
recv = self.chan.recv(1024)
print recv
if not len(recv):
return
data += recv