Commit 2be815a1 authored by Denis Bilenko's avatar Denis Bilenko

ssl: make send return 0 in case of non-blocking/timeout instead of raising...

ssl: make send return 0 in case of non-blocking/timeout instead of raising timeout (this is how standard ssl behaves)
parent 13aa0907
...@@ -182,7 +182,7 @@ class SSLSocket(socket): ...@@ -182,7 +182,7 @@ class SSLSocket(socket):
except SSLError, x: except SSLError, x:
if x.args[0] == SSL_ERROR_WANT_READ: if x.args[0] == SSL_ERROR_WANT_READ:
if self.timeout == 0.0: if self.timeout == 0.0:
raise timeout(str(x)) return 0
sys.exc_clear() sys.exc_clear()
try: try:
wait_read(self.fileno(), timeout=timeout, event=self._read_event) wait_read(self.fileno(), timeout=timeout, event=self._read_event)
...@@ -192,7 +192,7 @@ class SSLSocket(socket): ...@@ -192,7 +192,7 @@ class SSLSocket(socket):
raise raise
elif x.args[0] == SSL_ERROR_WANT_WRITE: elif x.args[0] == SSL_ERROR_WANT_WRITE:
if self.timeout == 0.0: if self.timeout == 0.0:
raise timeout(str(x)) return 0
sys.exc_clear() sys.exc_clear()
try: try:
wait_write(self.fileno(), timeout=timeout, event=self._write_event) wait_write(self.fileno(), timeout=timeout, event=self._write_event)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment