diff --git a/gajim/common/socks5.py b/gajim/common/socks5.py index a37ce0e27..9cea47389 100644 --- a/gajim/common/socks5.py +++ b/gajim/common/socks5.py @@ -687,13 +687,11 @@ class Socks5: OpenSSL.SSL.WantX509LookupError) as e: log.info('SSL rehandshake request: %s', repr(e)) raise e + except OpenSSL.SSL.SysCallError: + return self._on_send_exception() except Exception as e: if e.errno not in (EINTR, ENOBUFS, EWOULDBLOCK): - # peer stopped reading - self.state = 8 # end connection - self.disconnect() - self.file_props.error = -1 - return -1 + return self._on_send_exception() self.size += lenn current_time = time.time() self.file_props.elapsed_time += current_time - \ @@ -719,6 +717,13 @@ class Socks5: self.disconnect() return -1 + def _on_send_exception(self): + # peer stopped reading + self.state = 8 # end connection + self.disconnect() + self.file_props.error = -1 + return -1 + def get_file_contents(self, timeout): """ Read file contents from socket and write them to file