Ingore SSL_ERROR_WANT_READ/WRITE errors

Before this change, the connection would be defuncted when the error
occurred.  Instead, these can safely be ignored and the recv() call
retried.
This commit is contained in:
Tyler Hobbs
2014-03-07 16:32:13 -06:00
parent c0f3c27d75
commit e5b751333c
3 changed files with 13 additions and 2 deletions

View File

@@ -12,6 +12,9 @@ Bug Fixes
* Correctly supply compaction and compression parameters in CREATE statements
for tables when working with Cassandra 2.0+
* Lowercase boolean literals when generating schemas
* Ignore SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE socket errors. Previously,
these resulted in the connection being defuncted, but they can safely be
ignored by the driver.
Other
-----

View File

@@ -258,7 +258,11 @@ class AsyncoreConnection(Connection, asyncore.dispatcher):
if len(buf) < self.in_buffer_size:
break
except socket.error as err:
if err.args[0] not in NONBLOCKING:
if ssl and isinstance(err, ssl.SSLError):
if err.args[0] not in (ssl.SSL_ERROR_WANT_READ, ssl.SSL_ERROR_WANT_WRITE):
self.defunct(err)
return
elif err.args[0] not in NONBLOCKING:
self.defunct(err)
return

View File

@@ -311,7 +311,11 @@ class LibevConnection(Connection):
if len(buf) < self.in_buffer_size:
break
except socket.error as err:
if err.args[0] not in NONBLOCKING:
if ssl and isinstance(err, ssl.SSLError):
if err.args[0] not in (ssl.SSL_ERROR_WANT_READ, ssl.SSL_ERROR_WANT_WRITE):
self.defunct(err)
return
elif err.args[0] not in NONBLOCKING:
self.defunct(err)
return