OK
continuous-integration/drone/push Build is passing Details

This commit is contained in:
DESKTOP-DPA61F8\Benedek 2021-04-26 23:25:53 +02:00
parent 92c0f4a90a
commit 863a42e982
1 changed files with 18 additions and 13 deletions

View File

@ -89,6 +89,7 @@ if not os.path.isfile(CONFIG_LOCATION) or os.stat(CONFIG_LOCATION).st_size == 0:
SERVER_PUBLIC_KEY = loadPublicKey()
CLIENT_PRIVATE_KEY = loadPrivateKey(PASSPHRASE)
CLIENT_ADDRESS = loadAddress()
LOGGED_IN = False
while True:
command = input("Type a command:")
@ -99,21 +100,25 @@ while True:
print("Invalid command format!")
continue
if separatedCommand[0] == 'LIN' and len(separatedCommand) == 3:
network = NetWrapper(CLIENT_PRIVATE_KEY, CLIENT_ADDRESS, separatedCommand[1], SERVER_PUBLIC_KEY)
try:
network.connectToServer(separatedCommand[2])
response = network.recieveMessage().decode('UTF-8')
print(response)
if response == 'OK':
LOGGED_IN = True
else:
if not LOGGED_IN:
if separatedCommand[0] == 'LIN' and len(separatedCommand) == 3:
network = NetWrapper(CLIENT_PRIVATE_KEY, CLIENT_ADDRESS, separatedCommand[1], SERVER_PUBLIC_KEY)
try:
network.connectToServer(separatedCommand[2])
response = network.recieveMessage().decode('UTF-8')
print(response)
if response == 'OK':
LOGGED_IN = True
else:
LOGGED_IN = False
except Exception as e:
print("Error: "+str(e))
LOGGED_IN = False
except Exception as e:
print("Error: "+str(e))
LOGGED_IN = False
continue
continue
continue
else:
print('You are already logged in!')
if separatedCommand[0] == 'EXIT':
sys.exit(1)