mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2026-09-10 02:35:57 +00:00
Make creating a new sender cleaner
This commit is contained in:
@@ -130,6 +130,13 @@ class Connection:
|
||||
def close(self):
|
||||
self.conn.close()
|
||||
|
||||
def clone(self):
|
||||
"""Creates a copy of this Connection"""
|
||||
return Connection(self.ip, self.port,
|
||||
mode=self._mode,
|
||||
proxy=self.conn.proxy,
|
||||
timeout=self.conn.timeout)
|
||||
|
||||
# region Receive message implementations
|
||||
|
||||
def recv(self):
|
||||
|
||||
@@ -54,6 +54,10 @@ class MtProtoSender:
|
||||
self._need_confirmation.clear()
|
||||
self._clear_all_pending()
|
||||
|
||||
def clone(self):
|
||||
"""Creates a copy of this MtProtoSender as a new connection"""
|
||||
return MtProtoSender(self.session, self.connection.clone())
|
||||
|
||||
# region Send and receive
|
||||
|
||||
def send(self, *requests):
|
||||
|
||||
Reference in New Issue
Block a user