From 25417575ef795c36d2663c88fdedba5bfae5cc26 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Mon, 16 Feb 2009 01:24:26 -0800 Subject: [PATCH] make the transport a daemon thread since python 1.6 doesn't call the atexit handler correctly any more. also allow unicode as a hostname. --- paramiko/transport.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paramiko/transport.py b/paramiko/transport.py index a18e05b..cb3f54b 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -266,7 +266,7 @@ class Transport (threading.Thread): @param sock: a socket or socket-like object to create the session over. @type sock: socket """ - if type(sock) is str: + if isinstance(sock, (str, unicode)): # convert "host:port" into (host, port) hl = sock.split(':', 1) if len(hl) == 1: @@ -280,6 +280,7 @@ class Transport (threading.Thread): sock.connect((hostname, port)) # okay, normal socket-ish flow here... threading.Thread.__init__(self) + self.setDaemon(True) self.randpool = randpool self.sock = sock # Python < 2.3 doesn't have the settimeout method - RogerB