Remote driver now responds so you can know for sure the command worked.

This commit is contained in:
Storm Dragon
2025-06-06 20:32:46 -04:00
parent 8d50003730
commit a742c12cd8
2 changed files with 121 additions and 7 deletions

View File

@ -33,7 +33,7 @@ class driver(remoteDriver):
os.unlink(socketFile)
self.fenrirSock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.fenrirSock.bind(socketFile)
os.chmod(socketFile, 0o222)
os.chmod(socketFile, 0o666)
self.fenrirSock.listen(1)
while active.value:
# Check if the client is still connected and if data is available:
@ -45,17 +45,28 @@ class driver(remoteDriver):
continue
if self.fenrirSock in r:
client_sock, client_addr = self.fenrirSock.accept()
response = "ERROR: Failed to process command\n"
try:
rawdata = client_sock.recv(8129)
except:
pass
try:
data = rawdata.decode("utf-8").rstrip().lstrip()
eventQueue.put({"Type":fenrirEventType.RemoteIncomming,
"Data": data
})
if data:
# Process the command and get response
result = self.env['runtime']['remoteManager'].handleRemoteIncommingWithResponse(data)
if result['success']:
response = f"OK: {result['message']}\n"
else:
response = f"ERROR: {result['message']}\n"
else:
response = "ERROR: Empty command\n"
except Exception as e:
response = f"ERROR: {str(e)}\n"
# Send response back to client
try:
client_sock.send(response.encode("utf-8"))
except:
pass
try:
client_sock.close()
except: