Skip to content

Commit 74ea990

Browse files
committed
Inline _write_after_conn_lost
1 parent 20bd1cc commit 74ea990

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

Lib/asyncio/selector_events.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,11 +1048,6 @@ def _read_ready__on_eof(self):
10481048
else:
10491049
self.close()
10501050

1051-
def _write_after_conn_lost(self):
1052-
if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES:
1053-
logger.warning('socket.send() raised exception.')
1054-
self._conn_lost += 1
1055-
10561051
def write(self, data):
10571052
if not isinstance(data, (bytes, bytearray, memoryview)):
10581053
raise TypeError(f'data argument must be a bytes-like object, '
@@ -1065,7 +1060,9 @@ def write(self, data):
10651060
return
10661061

10671062
if self._conn_lost:
1068-
self._write_after_conn_lost()
1063+
if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES:
1064+
logger.warning('socket.send() raised exception.')
1065+
self._conn_lost += 1
10691066
return
10701067

10711068
if not self._buffer:
@@ -1179,7 +1176,9 @@ def writelines(self, list_of_data):
11791176
return
11801177

11811178
if self._conn_lost:
1182-
self._write_after_conn_lost()
1179+
if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES:
1180+
logger.warning('socket.send() raised exception.')
1181+
self._conn_lost += 1
11831182
return
11841183

11851184
self._buffer.extend([memoryview(data) for data in list_of_data])

0 commit comments

Comments
 (0)