Fix bug - sometime ssh forwarding connection cannot establish when cpu is in hight...
[remote-debug.git] / sztool
diff --git a/sztool b/sztool
index 0c4fd7c..efd4837 100755 (executable)
--- a/sztool
+++ b/sztool
@@ -15,7 +15,6 @@ URI = 'debug@autossh.suanzi.ai'
 
 def get_all_connected(host, port, user, password):
     command = 'sshpass -p' + password + ' ssh -q -o "StrictHostKeyChecking=no"  -o "UserKnownHostsFile /dev/null" ' + user + '@' + host + '  netstat -tn | grep ' + str(port) + ' | grep ESTABLISHED | wc -l'
-    #print command
     output = check_output(shlex.split(command), shell=False)
     return int(output)
 
@@ -26,11 +25,8 @@ def on_connect(client, userdata, flags, rc):
         payload = {'from':userdata['id'], 'type':'request', 'command':'ssh'}
         client.publish(userdata['to'], str(payload))
     elif userdata['action'] == 'list':
-        #timer = threading.Timer(20, timeout)
-        #timer.start()
         payload = {'from':userdata['id'], 'type':'request', 'command':'list'}
         client.publish(userdata['to'], str(payload))
-        #print '-' * 30
         print'{0}\t\t{1}'.format(' Device ID ', 'Data')
         print '-' * 30
 
@@ -55,12 +51,6 @@ def get_mac_str():
     mac = hex(get_mac())
     return '{:0>12}'.format(mac[2:-1])
 
-#def timeout():
-#    print 'timeout'
-#    client.disconnect()
-#    sys.exit(0)
-#
-
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(description='Choose an avaiable port and run ssh.', add_help=False)
     parser.add_argument('--help', action='help')