Commit 0d25a8f5 authored by ibuler's avatar ibuler

Use thread replace process

parent b4c64991
...@@ -92,7 +92,6 @@ class SSHServer(paramiko.ServerInterface): ...@@ -92,7 +92,6 @@ class SSHServer(paramiko.ServerInterface):
}) })
return paramiko.AUTH_SUCCESSFUL return paramiko.AUTH_SUCCESSFUL
else: else:
self.client.close()
logger.info('Authentication password failed for %(username)s from %(host)s port %(port)s ' % { logger.info('Authentication password failed for %(username)s from %(host)s port %(port)s ' % {
'username': username, 'username': username,
'host': self.addr[0], 'host': self.addr[0],
...@@ -275,10 +274,6 @@ class JumpServer: ...@@ -275,10 +274,6 @@ class JumpServer:
'host': addr[0], 'host': addr[0],
'port': addr[1], 'port': addr[1],
}) })
raise IndexError
dir(client)
client.close()
return False
try: try:
client_channel = self.get_client_channel(client, addr) client_channel = self.get_client_channel(client, addr)
...@@ -360,9 +355,9 @@ class JumpServer: ...@@ -360,9 +355,9 @@ class JumpServer:
while True: while True:
try: try:
client, addr = sock.accept() client, addr = sock.accept()
process = Process(target=self.handle_ssh_request, args=(client, addr)) thread = threading.Thread(target=self.handle_ssh_request, args=(client, addr))
process.daemon = True thread.daemon = True
process.start() thread.start()
except Exception as e: except Exception as e:
logger.error('Bind failed: ' + str(e)) logger.error('Bind failed: ' + str(e))
traceback.print_exc() traceback.print_exc()
......
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