Skip to content

Commit

Permalink
Merge pull request #1426 from medvi/master
Browse files Browse the repository at this point in the history
Fix # 960: AttributeError("'Connect' object has no attribute 'protocol'")
  • Loading branch information
carlosmiei authored Oct 21, 2024
2 parents 1db369d + f0c120e commit 9fb9731
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions binance/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,12 @@ def _get_reconnect_wait(self, attempts: int) -> int:
return round(random() * min(self.MAX_RECONNECT_SECONDS, expo - 1) + 1)

async def before_reconnect(self):
if self.ws and self._conn:
await self._conn.__aexit__(None, None, None)
if self.ws:
self.ws = None

if self._conn and hasattr(self._conn, 'protocol'):
await self._conn.__aexit__(None, None, None)

self._reconnects += 1

def _no_message_received_reconnect(self):
Expand Down

0 comments on commit 9fb9731

Please sign in to comment.