Commit bbf38e4c authored by ibuler's avatar ibuler

Change something

parent 05c0e693
...@@ -50,6 +50,7 @@ class Coco: ...@@ -50,6 +50,7 @@ class Coco:
self.make_logger() self.make_logger()
self.sshd = None self.sshd = None
self.running = True
def make_logger(self): def make_logger(self):
create_logger(self) create_logger(self)
......
...@@ -40,7 +40,7 @@ class ProxyServer: ...@@ -40,7 +40,7 @@ class ProxyServer:
try: try:
ssh.connect(asset.ip, port=asset.port, username=system_user.username, ssh.connect(asset.ip, port=asset.port, username=system_user.username,
password=system_user.password, pkey=system_user.private_key) password=system_user.password, pkey=system_user.private_key)
except (paramiko.AuthenticationException,) as e: except (paramiko.AuthenticationException, paramiko.ssh_exception.NoValidConnectionsError) as e:
pass pass
except socket.error: except socket.error:
......
#!coding: utf-8 #!coding: utf-8
import socket import socket
import select
from . import char from . import char
from .utils import TtyIOParser, wrap_with_line_feed as wr, \ from .utils import TtyIOParser, wrap_with_line_feed as wr, \
wrap_with_primary as primary, wrap_with_warning as warning wrap_with_primary as primary, wrap_with_warning as warning
......
import json import json
import threading import threading
import select
BUF_SIZE = 4096 BUF_SIZE = 4096
...@@ -160,12 +158,10 @@ class WSProxy: ...@@ -160,12 +158,10 @@ class WSProxy:
def forward(self): def forward(self):
while not self.stop_event.is_set(): while not self.stop_event.is_set():
r, w, e = select.select([self.child], [], []) data = self.child.recv(BUF_SIZE)
if self.child in r: if len(data) == 0:
data = self.child.recv(BUF_SIZE) self.close()
if len(data) == 0: self.ws.write_message(data)
self.close()
self.ws.write_message(data)
def auto_forward(self): def auto_forward(self):
thread = threading.Thread(target=self.forward, args=()) thread = threading.Thread(target=self.forward, args=())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment