server: Clear request flags when we disconnect.
The server class has a bunch of request flags that remember if a request of a certain type is in flight, this prevents making the same request multiple times. The flags are cleared when we get a response but not when we disconnect. If we disconnect from the server while waiting on a response the response will be lost and the flag won't be cleared, this will prevent us from making any request of that type. Most notably key queries can end up being disabled so new devices won't be recognized anymore.
This commit is contained in:
parent
5431c8a310
commit
c1cfc4a8e4
1 changed files with 9 additions and 1 deletions
|
@ -247,7 +247,6 @@ class MatrixServer(object):
|
|||
|
||||
self._connected = False # type: bool
|
||||
self.connecting = False # type: bool
|
||||
self.keys_queried = False # type: bool
|
||||
self.reconnect_delay = 0 # type: int
|
||||
self.reconnect_time = None # type: Optional[float]
|
||||
self.sync_time = None # type: Optional[float]
|
||||
|
@ -288,6 +287,10 @@ class MatrixServer(object):
|
|||
self.lazy_load_hook = None # type: Optional[str]
|
||||
self.partial_sync_hook = None # type: Optional[str]
|
||||
|
||||
# These flags remember if we made some requests so that we don't
|
||||
# make them again while we wait on a response, the flags need to be
|
||||
# cleared when we disconnect.
|
||||
self.keys_queried = False # type: bool
|
||||
self.keys_claimed = defaultdict(bool) # type: Dict[str, bool]
|
||||
self.group_session_shared = defaultdict(bool) # type: Dict[str, bool]
|
||||
|
||||
|
@ -554,6 +557,11 @@ class MatrixServer(object):
|
|||
W.bar_item_update("lag")
|
||||
self.reconnect_time = None
|
||||
|
||||
# Clear our request flags.
|
||||
self.keys_queried = False
|
||||
self.keys_claimed = defaultdict(bool)
|
||||
self.group_session_shared = defaultdict(bool)
|
||||
|
||||
if self.server_buffer:
|
||||
message = ("{prefix}matrix: disconnected from server").format(
|
||||
prefix=W.prefix("network")
|
||||
|
|
Loading…
Reference in a new issue