summaryrefslogtreecommitdiff
path: root/asyncio/transports.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2015-07-20 17:18:59 +0200
committerVictor Stinner <vstinner@redhat.com>2015-07-20 17:36:41 +0200
commit13b71a16ee9d5af4939a7e214e92fa89cb96f6a3 (patch)
treecb9525ce018206804591e7e255c5745a044018c6 /asyncio/transports.py
parent9bb67431adc916d9d4b4e23ca257658c980d035d (diff)
downloadtrollius-git-closing.tar.gz
Add closing read-only property to transportsclosing
* Disallow write() on closing transports * Disallow aslo calling pause_writing() and resume_writing() on StreamReaderProtocol if the transport is closing
Diffstat (limited to 'asyncio/transports.py')
-rw-r--r--asyncio/transports.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/asyncio/transports.py b/asyncio/transports.py
index 70b323f..5540f7e 100644
--- a/asyncio/transports.py
+++ b/asyncio/transports.py
@@ -14,6 +14,7 @@ class BaseTransport:
if extra is None:
extra = {}
self._extra = extra
+ self._closing = False
def get_extra_info(self, name, default=None):
"""Get optional transport information."""
@@ -29,6 +30,11 @@ class BaseTransport:
"""
raise NotImplementedError
+ @property
+ def closing(self):
+ """Is the transport being closed?"""
+ return self._closing
+
class ReadTransport(BaseTransport):
"""Interface for read-only transports."""