mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-21 00:07:51 +00:00
Fix broken HTTPClient.recreate code to actually clear session
This commit is contained in:
parent
0502c6a0d2
commit
1df3ed861c
@ -666,7 +666,7 @@ class Client:
|
||||
self._closed = False
|
||||
self._ready.clear()
|
||||
self._connection.clear()
|
||||
self.http.recreate()
|
||||
self.http.clear()
|
||||
|
||||
async def start(self, token: str, *, reconnect: bool = True) -> None:
|
||||
"""|coro|
|
||||
|
@ -351,11 +351,9 @@ class HTTPClient:
|
||||
user_agent = 'DiscordBot (https://github.com/Rapptz/discord.py {0}) Python/{1[0]}.{1[1]} aiohttp/{2}'
|
||||
self.user_agent: str = user_agent.format(__version__, sys.version_info, aiohttp.__version__)
|
||||
|
||||
def recreate(self) -> None:
|
||||
if self.__session.closed:
|
||||
self.__session = aiohttp.ClientSession(
|
||||
connector=self.connector, ws_response_class=DiscordClientWebSocketResponse
|
||||
)
|
||||
def clear(self) -> None:
|
||||
if self.__session and self.__session.closed:
|
||||
self.__session = MISSING
|
||||
|
||||
async def ws_connect(self, url: str, *, compress: int = 0) -> aiohttp.ClientWebSocketResponse:
|
||||
kwargs = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user