Move salt and ID to base session and remove unused imports

This commit is contained in:
Tulir Asokan
2018-03-02 18:39:04 +02:00
parent e1d7cc541f
commit dc2229fdba
3 changed files with 15 additions and 30 deletions

View File

@@ -1,21 +1,13 @@
import json
import os
import platform
import sqlite3
import struct
import time
from base64 import b64decode
from os.path import isfile as file_exists
from threading import Lock, RLock
from .. import utils
from .abstract import Session
from .memory import MemorySession, _SentFileType
from ..crypto import AuthKey
from ..tl import TLObject
from ..tl.types import (
PeerUser, PeerChat, PeerChannel,
InputPeerUser, InputPeerChat, InputPeerChannel,
InputPhoto, InputDocument
)
@@ -47,8 +39,6 @@ class SQLiteSession(MemorySession):
if not self.filename.endswith(EXTENSION):
self.filename += EXTENSION
self.id = struct.unpack('q', os.urandom(8))[0]
# Cross-thread safety
self._seq_no_lock = Lock()
self._msg_id_lock = Lock()
@@ -193,7 +183,7 @@ class SQLiteSession(MemorySession):
self._auth_key = None
c.close()
@Session.auth_key.setter
@MemorySession.auth_key.setter
def auth_key(self, value):
self._auth_key = value
self._update_session_table()