Merge branch 'master' into libev-direct
This commit is contained in:
22
README.rst
22
README.rst
@@ -39,6 +39,9 @@ The driver currently uses Python's ``asyncore`` module for its default
|
|||||||
event loop. For better performance, ``libev`` is also supported through
|
event loop. For better performance, ``libev`` is also supported through
|
||||||
a C extension.
|
a C extension.
|
||||||
|
|
||||||
|
Linux
|
||||||
|
^^^^^
|
||||||
|
|
||||||
If you're on Linux, you should be able to install libev
|
If you're on Linux, you should be able to install libev
|
||||||
through a package manager. For example, on Debian/Ubuntu:
|
through a package manager. For example, on Debian/Ubuntu:
|
||||||
|
|
||||||
@@ -46,6 +49,25 @@ through a package manager. For example, on Debian/Ubuntu:
|
|||||||
|
|
||||||
$ sudo apt-get install libev4 libev-dev
|
$ sudo apt-get install libev4 libev-dev
|
||||||
|
|
||||||
|
OS X
|
||||||
|
^^^^
|
||||||
|
|
||||||
|
If you're on Mac OS X, you should be able to install libev
|
||||||
|
through `Homebrew <http://brew.sh/>`_. For example, on Mac OS X:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ brew install libev
|
||||||
|
|
||||||
|
and then install ``pyev`` as follows:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ pip install pyev
|
||||||
|
|
||||||
|
Usage
|
||||||
|
^^^^^
|
||||||
|
|
||||||
If successful, you should be able to use the libev event loop by
|
If successful, you should be able to use the libev event loop by
|
||||||
doing the following
|
doing the following
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from cassandra.marshal import int8_unpack
|
|||||||
from cassandra.decoder import (ReadyMessage, AuthenticateMessage, OptionsMessage,
|
from cassandra.decoder import (ReadyMessage, AuthenticateMessage, OptionsMessage,
|
||||||
StartupMessage, ErrorMessage, CredentialsMessage,
|
StartupMessage, ErrorMessage, CredentialsMessage,
|
||||||
QueryMessage, ResultMessage, decode_response,
|
QueryMessage, ResultMessage, decode_response,
|
||||||
InvalidRequestException)
|
InvalidRequestException, SupportedMessage)
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@@ -194,6 +194,11 @@ class Connection(object):
|
|||||||
def _handle_options_response(self, options_response):
|
def _handle_options_response(self, options_response):
|
||||||
if self.is_defunct:
|
if self.is_defunct:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not isinstance(options_response, SupportedMessage):
|
||||||
|
log.error("Did not get expected SupportedMessage response; instead, got: %s", options_response)
|
||||||
|
return
|
||||||
|
|
||||||
log.debug("Received options response on new Connection from %s" % self.host)
|
log.debug("Received options response on new Connection from %s" % self.host)
|
||||||
self.supported_cql_versions = options_response.cql_versions
|
self.supported_cql_versions = options_response.cql_versions
|
||||||
self.remote_supported_compressions = options_response.options['COMPRESSION']
|
self.remote_supported_compressions = options_response.options['COMPRESSION']
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ class LibevConnectionTest(unittest.TestCase):
|
|||||||
|
|
||||||
# make sure it errored correctly
|
# make sure it errored correctly
|
||||||
self.assertTrue(c.is_defunct)
|
self.assertTrue(c.is_defunct)
|
||||||
self.assertTrue(isinstance(c.last_error, ProtocolError))
|
|
||||||
self.assertTrue(c.connected_event.is_set())
|
self.assertTrue(c.connected_event.is_set())
|
||||||
|
self.assertTrue(isinstance(c.last_error, ProtocolError))
|
||||||
|
|
||||||
def test_error_message_on_startup(self, *args):
|
def test_error_message_on_startup(self, *args):
|
||||||
c = self.make_connection()
|
c = self.make_connection()
|
||||||
|
|||||||
Reference in New Issue
Block a user