diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 61178a70..49935615 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,11 +12,15 @@ 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 ----- * Don't ignore column names when parsing typestrings. This is needed for user-defined type support. (github issue #90) +* Better error message when libevwrapper is not found 1.0.2 ===== diff --git a/cassandra/io/asyncorereactor.py b/cassandra/io/asyncorereactor.py index 439648a2..c5fcc058 100644 --- a/cassandra/io/asyncorereactor.py +++ b/cassandra/io/asyncorereactor.py @@ -220,7 +220,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 diff --git a/cassandra/io/libevreactor.py b/cassandra/io/libevreactor.py index caedb01e..9826b059 100644 --- a/cassandra/io/libevreactor.py +++ b/cassandra/io/libevreactor.py @@ -8,7 +8,16 @@ from cassandra import OperationTimedOut from cassandra.connection import Connection, ConnectionShutdown, NONBLOCKING from cassandra.decoder import RegisterMessage from cassandra.marshal import int32_unpack -import cassandra.io.libevwrapper as libev +try: + import cassandra.io.libevwrapper as libev +except ImportError: + raise ImportError( + "The C extension needed to use libev was not found. This " + "probably means that you didn't have the required build dependencies " + "when installing the driver. See " + "http://datastax.github.io/python-driver/installation.html#c-extensions " + "for instructions on installing build dependencies and building " + "the C extension.") try: from cStringIO import StringIO @@ -261,7 +270,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