summaryrefslogtreecommitdiff
path: root/paramiko/transport.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2023-01-09 21:29:04 -0500
committerJeff Forcier <jeff@bitprophet.org>2023-01-09 23:26:00 -0500
commit74eae059e2ae71044e31a580bc4ede1057c0053b (patch)
tree8c26afc3ce0c0c6494352791fd79b59ad222fb7f /paramiko/transport.py
parent4495c4054233c5f7b3c4ffb3fb52ca525bc0d983 (diff)
downloadparamiko-74eae059e2ae71044e31a580bc4ede1057c0053b.tar.gz
Remove py3compat.PY2, including related streamlining
Diffstat (limited to 'paramiko/transport.py')
-rw-r--r--paramiko/transport.py34
1 files changed, 14 insertions, 20 deletions
diff --git a/paramiko/transport.py b/paramiko/transport.py
index 930ba4d4..23eda83b 100644
--- a/paramiko/transport.py
+++ b/paramiko/transport.py
@@ -101,7 +101,7 @@ from paramiko.kex_gss import KexGSSGex, KexGSSGroup1, KexGSSGroup14
from paramiko.message import Message
from paramiko.packet import Packetizer, NeedRekeyException
from paramiko.primes import ModulusPack
-from paramiko.py3compat import string_types, long, b, input, PY2
+from paramiko.py3compat import string_types, long, b, input
from paramiko.rsakey import RSAKey
from paramiko.ecdsakey import ECDSAKey
from paramiko.server import ServerInterface
@@ -1845,25 +1845,19 @@ class Transport(threading.Thread, ClosingContextManager):
def stop_thread(self):
self.active = False
self.packetizer.close()
- if PY2:
- # Original join logic; #520 doesn't appear commonly present under
- # Python 2.
- while self.is_alive() and self is not threading.current_thread():
- self.join(10)
- else:
- # Keep trying to join() our main thread, quickly, until:
- # * We join()ed successfully (self.is_alive() == False)
- # * Or it looks like we've hit issue #520 (socket.recv hitting some
- # race condition preventing it from timing out correctly), wherein
- # our socket and packetizer are both closed (but where we'd
- # otherwise be sitting forever on that recv()).
- while (
- self.is_alive()
- and self is not threading.current_thread()
- and not self.sock._closed
- and not self.packetizer.closed
- ):
- self.join(0.1)
+ # Keep trying to join() our main thread, quickly, until:
+ # * We join()ed successfully (self.is_alive() == False)
+ # * Or it looks like we've hit issue #520 (socket.recv hitting some
+ # race condition preventing it from timing out correctly), wherein
+ # our socket and packetizer are both closed (but where we'd
+ # otherwise be sitting forever on that recv()).
+ while (
+ self.is_alive()
+ and self is not threading.current_thread()
+ and not self.sock._closed
+ and not self.packetizer.closed
+ ):
+ self.join(0.1)
# internals...