Skip to content

Commit a8fa5a4

Browse files
committed
Added exception information to starting ssh server failure
1 parent 58e3f30 commit a8fa5a4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

fake_server/fake_server.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ def listen(cmd_req_response, sock, fail_auth = False):
8989
try:
9090
sock.listen(100)
9191
logger.info('Listening for connection on %s:%s..', listen_ip, listen_port)
92-
client, addr = sock.accept()
92+
# client, addr = sock.accept()
9393
except Exception, e:
9494
logger.error('*** Listen failed: %s' % (str(e),))
9595
traceback.print_exc()
9696
return
9797
# accept_thread = gevent.spawn(handle_ssh_connection,
9898
# cmd_req_response, client, addr,
9999
# fail_auth=fail_auth)
100-
handle_ssh_connection(cmd_req_response, client, addr, fail_auth=fail_auth)
100+
handle_ssh_connection(cmd_req_response, sock, fail_auth=fail_auth)
101101
# accept_thread.start()
102102
# return accept_thread
103103

@@ -110,8 +110,8 @@ def _handle_ssh_connection(cmd_req_response, t, fail_auth = False):
110110
server = Server(cmd_req_response = cmd_req_response, fail_auth = fail_auth)
111111
try:
112112
t.start_server(server=server)
113-
except paramiko.SSHException, _:
114-
logger.error('SSH negotiation failed.')
113+
except paramiko.SSHException, e:
114+
logger.exception('SSH negotiation failed')
115115
return
116116
return _accept_ssh_data(t, server)
117117

@@ -131,8 +131,8 @@ def _accept_ssh_data(t, server):
131131
time.sleep(.5)
132132
chan.close()
133133

134-
def handle_ssh_connection(cmd_req_response, client, addr, fail_auth = False):
135-
# client, addr = sock.accept()
134+
def handle_ssh_connection(cmd_req_response, sock, fail_auth = False):
135+
client, addr = sock.accept()
136136
logger.info('Got connection..')
137137
try:
138138
t = paramiko.Transport(client)

0 commit comments

Comments
 (0)