Dismiss WiFi boot prompt when mobile session opens
This commit is contained in:
@@ -2,11 +2,14 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import threading
|
||||
import time
|
||||
|
||||
from .protocol import Handshake, ProtocolError, Reassembler
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RpcError(Exception):
|
||||
def __init__(self, code, message):
|
||||
@@ -23,10 +26,12 @@ def checked_name(value):
|
||||
|
||||
|
||||
class SessionManager:
|
||||
def __init__(self, dispatch, identity, *, clock=time.monotonic, wifi_address=lambda: None):
|
||||
def __init__(self, dispatch, identity, *, clock=time.monotonic, wifi_address=lambda: None,
|
||||
on_session_open=None):
|
||||
self.dispatch = dispatch
|
||||
self.identity = identity
|
||||
self.clock = clock
|
||||
self.on_session_open = on_session_open
|
||||
self.lock = threading.RLock()
|
||||
self.owner = None
|
||||
self.receiver = None
|
||||
@@ -116,6 +121,13 @@ class SessionManager:
|
||||
self.client_name = name
|
||||
self.opened = True
|
||||
self.generation += 1
|
||||
if self.on_session_open is not None:
|
||||
try:
|
||||
self.on_session_open()
|
||||
except Exception:
|
||||
# A failed display notification must not invalidate
|
||||
# an already established encrypted session.
|
||||
logger.exception("Mobile session-open notification failed")
|
||||
elif method == "session.ping":
|
||||
result = dict(alive=True)
|
||||
elif method == "session.rename":
|
||||
|
||||
Reference in New Issue
Block a user