Skip to content

Commit 8d9ce69

Browse files
committed
Make sure that _read_watcher is not empty before start it
Prevent following to happen: ``` File "cassandra/io/libevreactor.py", line 197, in _loop_will_run conn._read_watcher.start() AttributeError: 'NoneType' object has no attribute 'start' ```
1 parent c7ca1c6 commit 8d9ce69

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cassandra/io/libevreactor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ def connection_created(self, conn):
165165

166166
def connection_destroyed(self, conn):
167167
with self._conn_set_lock:
168+
new_conns = self._new_conns.copy()
169+
new_conns.discard(conn)
170+
self._new_conns = new_conns
171+
168172
new_live_conns = self._live_conns.copy()
169173
new_live_conns.discard(conn)
170174
self._live_conns = new_live_conns
@@ -194,7 +198,8 @@ def _loop_will_run(self, prepare):
194198
self._new_conns = set()
195199

196200
for conn in to_start:
197-
conn._read_watcher.start()
201+
if conn._read_watcher:
202+
conn._read_watcher.start()
198203

199204
changed = True
200205

0 commit comments

Comments
 (0)