From ec20af69417d1f44af4e31b928a8410fa18489a4 Mon Sep 17 00:00:00 2001 From: Dimitur Kirov Date: Wed, 17 Aug 2005 15:38:57 +0000 Subject: [PATCH] open file only once on sending --- src/common/socks5.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/common/socks5.py b/src/common/socks5.py index 2612f5acb..1ffe588b7 100644 --- a/src/common/socks5.py +++ b/src/common/socks5.py @@ -351,7 +351,6 @@ class Socks5: def open_file_for_reading(self): self.fd = open(self.file_props['file-name']) - self.fd.seek(self.size) def close_file(self): try: @@ -425,9 +424,7 @@ class Socks5: buff = self.remaining_buff self.remaining_buff = '' else: - self.open_file_for_reading() buff = self.fd.read(MAX_BUFF_LEN) - self.close_file() if len(buff) > 0: lenn = 0 try: @@ -656,6 +653,7 @@ class Socks5Sender(Socks5): def send_file(self): ''' start sending the file over verified connection ''' + self.open_file_for_reading() self.file_props['error'] = 0 self.file_props['disconnect_cb'] = self.disconnect self.file_props['started'] = True