fix tests and added is_reading() to unixReadPipeTransport
This commit is contained in:
parent
a16f4d380c
commit
c4b3444f9b
|
@ -773,7 +773,7 @@ class _SelectorSocketTransport(_SelectorTransport):
|
|||
return not self._paused and not self._closing
|
||||
|
||||
def pause_reading(self):
|
||||
if self._closing or self._paused:
|
||||
if not self.is_reading():
|
||||
return
|
||||
self._paused = True
|
||||
self._loop._remove_reader(self._sock_fd)
|
||||
|
|
|
@ -466,11 +466,15 @@ class _UnixReadPipeTransport(transports.ReadTransport):
|
|||
# only wake up the waiter when connection_made() has been called
|
||||
self._loop.call_soon(futures._set_result_unless_cancelled,
|
||||
waiter, None)
|
||||
|
||||
def _add_reader(self, fd, callback):
|
||||
if not self.is_reading():
|
||||
return
|
||||
self._loop._add_reader(fd, callback)
|
||||
|
||||
def is_reading(self):
|
||||
return not self._paused and not self._closing
|
||||
|
||||
def __repr__(self):
|
||||
info = [self.__class__.__name__]
|
||||
if self._pipe is None:
|
||||
|
@ -511,7 +515,7 @@ class _UnixReadPipeTransport(transports.ReadTransport):
|
|||
self._loop.call_soon(self._call_connection_lost, None)
|
||||
|
||||
def pause_reading(self):
|
||||
if self._closing or self._paused:
|
||||
if not self.is_reading():
|
||||
return
|
||||
self._paused = True
|
||||
self._loop._remove_reader(self._fileno)
|
||||
|
|
Loading…
Reference in New Issue