From 2eb4bc212db7f923383d5128b00617e37cb0fce2 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Dec 05 2012 15:59:22 +0000 Subject: Add support for zmq_tcp_keepalive. Also, fix bad rhel conditional. --- diff --git a/0003-Allow-the-user-to-set-TCP-keepalive-options.patch b/0003-Allow-the-user-to-set-TCP-keepalive-options.patch new file mode 100644 index 0000000..20fb9b9 --- /dev/null +++ b/0003-Allow-the-user-to-set-TCP-keepalive-options.patch @@ -0,0 +1,46 @@ +From 2c1ee2d8803dfd37c7fb72d313aaaa2f71e83bf6 Mon Sep 17 00:00:00 2001 +From: Ralph Bean +Date: Wed, 5 Dec 2012 10:47:14 -0500 +Subject: [PATCH] Allow the user to set TCP keepalive options. + +--- + txzmq/connection.py | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/txzmq/connection.py b/txzmq/connection.py +index 0458758..11166d8 100644 +--- a/txzmq/connection.py ++++ b/txzmq/connection.py +@@ -63,6 +63,12 @@ class ZmqConnection(object): + multicastRate = 100 + highWaterMark = 0 + ++ # Only supported by zeromq3 and pyzmq>=2.2.0.1 ++ tcpKeepalive = 0 ++ tcpKeepaliveCount = 0 ++ tcpKeepaliveIdle = 0 ++ tcpKeepaliveInterval = 0 ++ + def __init__(self, factory, endpoint=None, identity=None): + """ + Constructor. +@@ -100,6 +106,16 @@ class ZmqConnection(object): + self.socket.setsockopt(constants.SNDHWM, self.highWaterMark) + self.socket.setsockopt(constants.RCVHWM, self.highWaterMark) + ++ if ZMQ3 and self.tcpKeepalive: ++ self.socket.setsockopt( ++ constants.TCP_KEEPALIVE, self.tcpKeepalive) ++ self.socket.setsockopt( ++ constants.TCP_KEEPALIVE_CNT, self.tcpKeepaliveCount) ++ self.socket.setsockopt( ++ constants.TCP_KEEPALIVE_IDLE, self.tcpKeepaliveIdle) ++ self.socket.setsockopt( ++ constants.TCP_KEEPALIVE_INTVL, self.tcpKeepaliveInterval) ++ + if self.identity is not None: + self.socket.setsockopt(constants.IDENTITY, self.identity) + +-- +1.8.0.1 + diff --git a/python-txzmq.spec b/python-txzmq.spec index f9354f5..075a080 100644 --- a/python-txzmq.spec +++ b/python-txzmq.spec @@ -2,7 +2,7 @@ Name: python-txzmq Version: 0.6.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Twisted bindings for ZeroMQ Group: Development/Languages @@ -11,6 +11,8 @@ URL: http://pypi.python.org/pypi/%{modname} Source0: http://pypi.python.org/packages/source/t/%{modname}/%{modname}-%{version}.tar.gz Patch0: 0001-Disable-epgm-test.patch Patch1: 0002-Support-older-pyzmq.patch +# Upstream - https://github.com/smira/txZMQ/pull/38 +Patch2: 0003-Allow-the-user-to-set-TCP-keepalive-options.patch BuildArch: noarch @@ -32,10 +34,11 @@ Twisted event loop (reactor). %setup -q -n %{modname}-%{version} %patch0 -p1 -b .disable_epgm_test %patch1 -p1 -b .disable-older-pyzmq +%patch2 -p1 -b .allow-tcp-keepalive # Patch out the setuptools requirement on Twisted since epel doesn't ship # twisted egg-info -%if %{?rhel}%{!?rhel:0} >= 6 +%if 0%{?rhel} %{__sed} -i 's/"Twisted",//' setup.py %endif @@ -55,6 +58,10 @@ PYTHONPATH=$(pwd) nosetests %{python_sitelib}/* %changelog +* Wed Dec 05 2012 Ralph Bean - 0.6.1-3 +- Patch to add support for tcp keepalives with zeromq3. +- Fixed "bad" rhel conditional. + * Mon Oct 29 2012 Ralph Bean - 0.6.1-2 - Patch (again) to support older pyzmq on f17 and el6.