server: Add key query functionality.
This commit is contained in:
parent
0872948e9e
commit
8fbaf763b1
1 changed files with 12 additions and 3 deletions
|
@ -22,7 +22,7 @@ import socket
|
||||||
import ssl
|
import ssl
|
||||||
import time
|
import time
|
||||||
from collections import defaultdict, deque
|
from collections import defaultdict, deque
|
||||||
from typing import Any, Deque, Dict, Optional
|
from typing import Any, Deque, Dict, Optional, List
|
||||||
|
|
||||||
from nio import (
|
from nio import (
|
||||||
HttpClient,
|
HttpClient,
|
||||||
|
@ -193,6 +193,7 @@ class MatrixServer(object):
|
||||||
|
|
||||||
self.connected = False # type: bool
|
self.connected = False # type: bool
|
||||||
self.connecting = False # type: bool
|
self.connecting = False # type: bool
|
||||||
|
self.keys_queried = False # type: bool
|
||||||
self.reconnect_delay = 0 # type: int
|
self.reconnect_delay = 0 # type: int
|
||||||
self.reconnect_time = None # type: Optional[float]
|
self.reconnect_time = None # type: Optional[float]
|
||||||
self.sync_time = None # type: Optional[float]
|
self.sync_time = None # type: Optional[float]
|
||||||
|
@ -223,7 +224,7 @@ class MatrixServer(object):
|
||||||
self.backlog_queue = dict() # type: Dict[str, str]
|
self.backlog_queue = dict() # type: Dict[str, str]
|
||||||
|
|
||||||
self.unhandled_users = dict() # type: Dict[str, List[str]]
|
self.unhandled_users = dict() # type: Dict[str, List[str]]
|
||||||
self.lazy_load_hook = None # type: str
|
self.lazy_load_hook = None # type: Optional[str]
|
||||||
|
|
||||||
self.config = ServerConfig(self.name, config_ptr)
|
self.config = ServerConfig(self.name, config_ptr)
|
||||||
self._create_session_dir()
|
self._create_session_dir()
|
||||||
|
@ -645,6 +646,11 @@ class MatrixServer(object):
|
||||||
_, request = self.client.keys_upload()
|
_, request = self.client.keys_upload()
|
||||||
self.send_or_queue(request)
|
self.send_or_queue(request)
|
||||||
|
|
||||||
|
def keys_query(self):
|
||||||
|
_, request = self.client.keys_query()
|
||||||
|
self.keys_queried = True
|
||||||
|
self.send_or_queue(request)
|
||||||
|
|
||||||
def _print_message_error(self, message):
|
def _print_message_error(self, message):
|
||||||
server_buffer_prnt(
|
server_buffer_prnt(
|
||||||
self,
|
self,
|
||||||
|
@ -797,6 +803,9 @@ class MatrixServer(object):
|
||||||
if self.client.should_upload_keys:
|
if self.client.should_upload_keys:
|
||||||
self.keys_upload()
|
self.keys_upload()
|
||||||
|
|
||||||
|
if self.client.should_query_keys and not self.keys_queried:
|
||||||
|
self.keys_query()
|
||||||
|
|
||||||
self.schedule_sync()
|
self.schedule_sync()
|
||||||
|
|
||||||
def handle_transport_response(self, response):
|
def handle_transport_response(self, response):
|
||||||
|
|
Loading…
Add table
Reference in a new issue