Fixed small startup bug

This commit is contained in:
Brandon Rozek 2024-01-07 18:57:03 -05:00
parent ee214b7986
commit d6d42ebe81
No known key found for this signature in database
GPG key ID: 26E457DA82C9F480

View file

@ -30,6 +30,8 @@ MESSAGE_BUFFER_LEN = 1024
TOKEN_LENGTH = 50
TIMEOUT = 5 * 60 # 5 minutes
SERVER_FOLDER = Path(__file__).parent.absolute()
###
# Server
###
@ -98,8 +100,9 @@ def start_server(address, allow_other=True):
if allow_other:
# 33279 = '-rwxrwxrwx.'
os.chmod("game.sock", 33279)
os.chmod("challenges", 33279)
os.chmod(f"{SERVER_FOLDER}/game.sock", 33279)
if os.path.exists(f"{SERVER_FOLDER}/challenges"):
os.chmod(f"{SERVER_FOLDER}/challenges", 33279)
try:
yield sock
@ -108,7 +111,6 @@ def start_server(address, allow_other=True):
os.unlink(address)
def generate_challenge(user):
SERVER_FOLDER = Path(__file__).parent.absolute()
Path(f"{SERVER_FOLDER}/challenges").mkdir(mode=33279, exist_ok=True)
return ChallengeMessage(
username=user,