Skip to content

Commit

Permalink
Add explicit commentary re paramiko#537 in BufferedPipe.set_event
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed Jun 9, 2016
1 parent caa842b commit f1994dc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions paramiko/buffered_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ def set_event(self, event):
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:
Expand Down

0 comments on commit f1994dc

Please sign in to comment.