mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
ui,popups: fixed exception getting node address when adding a new rule
When a popup was displayed to the user, if they took more than 120s to respond, the address of the node was lost. This is because the daemon has hardcoded a max timeout of 120s. If it fires, the call to AskRule is closed and the context is lost. In this situation, save the address of the node at the start of AskRule, so we can reuse it later. Closes: #1219
This commit is contained in:
parent
cdf93c72c1
commit
db84b551cc
1 changed files with 5 additions and 4 deletions
|
@ -787,8 +787,9 @@ class UIService(ui_pb2_grpc.UIServicer, QtWidgets.QGraphicsObject):
|
||||||
|
|
||||||
# TODO: allow connections originated from ourselves: os.getpid() == request.pid)
|
# TODO: allow connections originated from ourselves: os.getpid() == request.pid)
|
||||||
self._asking = True
|
self._asking = True
|
||||||
proto, addr = self._get_peer(context.peer())
|
peer = context.peer()
|
||||||
rule, timeout_triggered = self._prompt_dialog.promptUser(request, self._is_local_request(proto, addr), context.peer())
|
proto, addr = self._get_peer(peer)
|
||||||
|
rule, timeout_triggered = self._prompt_dialog.promptUser(request, self._is_local_request(proto, addr), peer)
|
||||||
self._last_ping = datetime.now()
|
self._last_ping = datetime.now()
|
||||||
self._asking = False
|
self._asking = False
|
||||||
if rule == None:
|
if rule == None:
|
||||||
|
@ -812,14 +813,14 @@ class UIService(ui_pb2_grpc.UIServicer, QtWidgets.QGraphicsObject):
|
||||||
{
|
{
|
||||||
'action': self.DELETE_RULE,
|
'action': self.DELETE_RULE,
|
||||||
'name': rule.name,
|
'name': rule.name,
|
||||||
'addr': context.peer()
|
'addr': peer
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self._node_actions_trigger.emit(
|
self._node_actions_trigger.emit(
|
||||||
{
|
{
|
||||||
'action': self.ADD_RULE,
|
'action': self.ADD_RULE,
|
||||||
'peer': context.peer(),
|
'peer': peer,
|
||||||
'rule': rule
|
'rule': rule
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue