diff options
author | Adam Vandenberg <flangy@gmail.com> | 2011-03-27 12:34:04 -0700 |
---|---|---|
committer | Adam Vandenberg <flangy@gmail.com> | 2011-03-27 12:34:04 -0700 |
commit | 0c41a6f677a97ecd5fb981322f7a0c1a13ab25bf (patch) | |
tree | 24913b238e5199ae3afc621f8afadc471aaf774b /redis/connection.py | |
parent | 3eb84c538ab968ae7378ceb2282a31fa0169d34d (diff) | |
download | redis-py-0c41a6f677a97ecd5fb981322f7a0c1a13ab25bf.tar.gz |
Use IPPROTO_TCP instead of SOL_TCP
The constant value is the same, 6, but the former works in
Jython as well as CPython.
Diffstat (limited to 'redis/connection.py')
-rw-r--r-- | redis/connection.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/redis/connection.py b/redis/connection.py index 5839ebc..e317e85 100644 --- a/redis/connection.py +++ b/redis/connection.py @@ -3,11 +3,6 @@ import socket import threading from redis.exceptions import ConnectionError, ResponseError, InvalidResponse -# Jython doesn't define socket.SOL_TCP, but works fine with it's value, 6 -try: - SOL_TCP = socket.SOL_TCP -except AttributeError: - SOL_TCP = 6 class BaseConnection(object): "Manages TCP communication to and from a Redis server" @@ -39,7 +34,7 @@ class BaseConnection(object): error_message = "Error %s connecting %s:%s. %s." % \ (e.args[0], self.host, self.port, e.args[1]) raise ConnectionError(error_message) - sock.setsockopt(SOL_TCP, socket.TCP_NODELAY, 1) + sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) self._sock = sock self._fp = sock.makefile('r') redis_instance._setup_connection() |