Skip to content

Commit 9fb9731

Browse files
authored
Merge pull request sammchardy#1426 from medvi/master
Fix # 960: AttributeError("'Connect' object has no attribute 'protocol'")
2 parents 1db369d + f0c120e commit 9fb9731

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

binance/streams.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,12 @@ def _get_reconnect_wait(self, attempts: int) -> int:
209209
return round(random() * min(self.MAX_RECONNECT_SECONDS, expo - 1) + 1)
210210

211211
async def before_reconnect(self):
212-
if self.ws and self._conn:
213-
await self._conn.__aexit__(None, None, None)
212+
if self.ws:
214213
self.ws = None
214+
215+
if self._conn and hasattr(self._conn, 'protocol'):
216+
await self._conn.__aexit__(None, None, None)
217+
215218
self._reconnects += 1
216219

217220
def _no_message_received_reconnect(self):

0 commit comments

Comments
 (0)