[project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-7]
don't close the socket until the destructor -- we may drop a session before the socket is actually finished
This commit is contained in:
parent
2c264c7df5
commit
e8efe095a6
|
@ -25,6 +25,7 @@ Packetizer.
|
|||
import select, socket, struct, threading, time
|
||||
from Crypto.Hash import HMAC
|
||||
from common import *
|
||||
from ssh_exception import SSHException
|
||||
from message import Message
|
||||
import util
|
||||
|
||||
|
@ -75,6 +76,12 @@ class Packetizer (object):
|
|||
self.__keepalive_last = time.time()
|
||||
self.__keepalive_callback = None
|
||||
|
||||
def __del__(self):
|
||||
# this is not guaranteed to be called, but we should try.
|
||||
try:
|
||||
self.__socket.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
def set_log(self, log):
|
||||
"""
|
||||
|
@ -111,9 +118,6 @@ class Packetizer (object):
|
|||
|
||||
def close(self):
|
||||
self.__closed = True
|
||||
self.__block_engine_in = None
|
||||
self.__block_engine_out = None
|
||||
self.__socket.close()
|
||||
|
||||
def set_hexdump(self, hexdump):
|
||||
self.__dump_packets = hexdump
|
||||
|
@ -146,7 +150,6 @@ class Packetizer (object):
|
|||
self.__keepalive_interval = interval
|
||||
self.__keepalive_callback = callback
|
||||
self.__keepalive_last = time.time()
|
||||
self._log(DEBUG, 'SET KEEPALIVE %r' % interval)
|
||||
|
||||
def read_all(self, n):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue