XTLS: Fix endless loop on write error
This commit is contained in:
parent
9419e8ddf7
commit
05f1c78098
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue