More debugging

This commit is contained in:
2024-06-09 21:01:26 +02:00
parent a79ea39192
commit 36582e4854

View File

@@ -45,16 +45,20 @@ class routerstats_client():
try: try:
hello = self.sock.recv(5) hello = self.sock.recv(5)
except TimeoutError: except TimeoutError:
logging.error('Timeout while waiting for Hello')
raise ConnectionError('Timed out waiting for Hello when connecting') raise ConnectionError('Timed out waiting for Hello when connecting')
if not hello == b'Hello': if not hello == b'Hello':
logging.error('No Hello from server: %s', hello)
raise ConnectionError('Server did not greet us with Hello during login') raise ConnectionError('Server did not greet us with Hello during login')
with open('passwd.client', 'r') as passwd_file: with open('passwd.client', 'r') as passwd_file:
passwd = passwd_file.readline() passwd = passwd_file.readline()
passwd = passwd.rstrip() passwd = passwd.rstrip()
logging.debug('Sending password: %s', passwd)
self.sock.send(passwd.encode('utf-8')) self.sock.send(passwd.encode('utf-8'))
try: try:
response = self.sock.recv(7) response = self.sock.recv(7)
if not response == b'Welcome': if not response == b'Welcome':
logging.error('Not Welcome: %s', response)
raise ConnectionError('We are not greeted with Welcome after sending password') raise ConnectionError('We are not greeted with Welcome after sending password')
return True return True
except TimeoutError: except TimeoutError: