Skip to content

Commit 0c41a6f

Browse files
committed
Use IPPROTO_TCP instead of SOL_TCP
The constant value is the same, 6, but the former works in Jython as well as CPython.
1 parent 3eb84c5 commit 0c41a6f

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

redis/connection.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
import threading
44
from redis.exceptions import ConnectionError, ResponseError, InvalidResponse
55

6-
# Jython doesn't define socket.SOL_TCP, but works fine with it's value, 6
7-
try:
8-
SOL_TCP = socket.SOL_TCP
9-
except AttributeError:
10-
SOL_TCP = 6
116

127
class BaseConnection(object):
138
"Manages TCP communication to and from a Redis server"
@@ -39,7 +34,7 @@ def connect(self, redis_instance):
3934
error_message = "Error %s connecting %s:%s. %s." % \
4035
(e.args[0], self.host, self.port, e.args[1])
4136
raise ConnectionError(error_message)
42-
sock.setsockopt(SOL_TCP, socket.TCP_NODELAY, 1)
37+
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
4338
self._sock = sock
4439
self._fp = sock.makefile('r')
4540
redis_instance._setup_connection()

0 commit comments

Comments
 (0)