some niceness2
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2021-04-26 22:40:04 +02:00
parent cced3c49ef
commit 2d426a9f73
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -40,13 +40,12 @@ class Server:
parsedCommand = command.split(" ") parsedCommand = command.split(" ")
if len(parsedCommand) > 3: if len(parsedCommand) > 3:
self.networkInstance.sendMessage("ERROR".encode('UTF-8')) self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
# TODO: Ez igy gecironda, ezt meg kene csinalni rendesen.
elif len(parsedCommand) == 1: elif len(parsedCommand) == 1:
return self.execute(parsedCommand[0]) self.execute(parsedCommand[0])
elif len(parsedCommand) == 2: elif len(parsedCommand) == 2:
return self.execute(parsedCommand[0], parsedCommand[1]) self.execute(parsedCommand[0], parsedCommand[1])
elif len(parsedCommand) == 3: elif len(parsedCommand) == 3:
return self.execute(parsedCommand[0], parsedCommand[1], parsedCommand[2]) self.execute(parsedCommand[0], parsedCommand[1], parsedCommand[2])
def execute(self, command: str, firstParam: str = "", secondParam: str = "") -> None: def execute(self, command: str, firstParam: str = "", secondParam: str = "") -> None:
if self.executor.baseDir == "": if self.executor.baseDir == "":
@ -121,4 +120,5 @@ class Server:
message = self.networkInstance.recieveMessage().decode('UTF-8') message = self.networkInstance.recieveMessage().decode('UTF-8')
self.parseCommand(message) self.parseCommand(message)
except Exception as e: except Exception as e:
self.networkInstance.sendMessage("ERROR".encode('UTF-8'))
print(e) print(e)