ipc: Add got_invalid_data signal.
This commit is contained in:
parent
52210442c4
commit
cbcd6261b1
@ -96,9 +96,11 @@ class IPCServer(QObject):
|
|||||||
Signals:
|
Signals:
|
||||||
got_args: Emitted when there was an IPC connection and arguments were
|
got_args: Emitted when there was an IPC connection and arguments were
|
||||||
passed.
|
passed.
|
||||||
|
got_invalid_data: Emitted when there was invalid incoming data.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
got_args = pyqtSignal(list, str)
|
got_args = pyqtSignal(list, str)
|
||||||
|
got_invalid_data = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, socketname, parent=None):
|
def __init__(self, socketname, parent=None):
|
||||||
"""Start the IPC server and listen to commands.
|
"""Start the IPC server and listen to commands.
|
||||||
@ -202,6 +204,7 @@ class IPCServer(QObject):
|
|||||||
log.ipc.error("Ignoring invalid IPC data.")
|
log.ipc.error("Ignoring invalid IPC data.")
|
||||||
log.ipc.debug("invalid data: {}".format(
|
log.ipc.debug("invalid data: {}".format(
|
||||||
binascii.hexlify(data)))
|
binascii.hexlify(data)))
|
||||||
|
self.got_invalid_data.emit()
|
||||||
return
|
return
|
||||||
log.ipc.debug("Processing: {}".format(decoded))
|
log.ipc.debug("Processing: {}".format(decoded))
|
||||||
try:
|
try:
|
||||||
@ -209,12 +212,14 @@ class IPCServer(QObject):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
log.ipc.error("Ignoring invalid IPC data.")
|
log.ipc.error("Ignoring invalid IPC data.")
|
||||||
log.ipc.debug("invalid json: {}".format(decoded.strip()))
|
log.ipc.debug("invalid json: {}".format(decoded.strip()))
|
||||||
|
self.got_invalid_data.emit()
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
args = json_data['args']
|
args = json_data['args']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
log.ipc.error("Ignoring invalid IPC data.")
|
log.ipc.error("Ignoring invalid IPC data.")
|
||||||
log.ipc.debug("no args: {}".format(decoded.strip()))
|
log.ipc.debug("no args: {}".format(decoded.strip()))
|
||||||
|
self.got_invalid_data.emit()
|
||||||
return
|
return
|
||||||
cwd = json_data.get('cwd', None)
|
cwd = json_data.get('cwd', None)
|
||||||
self.got_args.emit(args, cwd)
|
self.got_args.emit(args, cwd)
|
||||||
|
Loading…
Reference in New Issue
Block a user