summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2016-06-09 10:39:53 -0700
committerJeff Forcier <jeff@bitprophet.org>2016-06-09 10:39:53 -0700
commitf1994dc8da8f30e383508f2c001065e2e2741a91 (patch)
treec0e4f6f619d6990383044def7809ae4e8d39516b
parentcaa842bf5d5b59002e8277f55ccd29c531aea08e (diff)
Add explicit commentary re #537 in BufferedPipe.set_event
-rw-r--r--paramiko/buffered_pipe.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/paramiko/buffered_pipe.py b/paramiko/buffered_pipe.py
index e81e9b3d..605f51e9 100644
--- a/paramiko/buffered_pipe.py
+++ b/paramiko/buffered_pipe.py
@@ -73,6 +73,11 @@ class BufferedPipe (object):
self._lock.acquire()
try:
self._event = event
+ # Make sure the event starts in `set` state if we appear to already
+ # be closed; otherwise, if we start in `clear` state & are closed,
+ # nothing will ever call `.feed` and the event (& OS pipe, if we're
+ # wrapping one - see `Channel.fileno`) will permanently stay in
+ # `clear`, causing deadlock if e.g. `select`ed upon.
if self._closed or len(self._buffer) > 0:
event.set()
else: