You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kg...@apache.org on 2014/02/21 19:34:41 UTC
svn commit: r1570653 - in /qpid/proton/trunk:
proton-c/src/transport/transport.c tests/python/proton_tests/engine.py
Author: kgiusti
Date: Fri Feb 21 18:34:40 2014
New Revision: 1570653
URL: http://svn.apache.org/r1570653
Log:
PROTON-507: advertise 1/2 the configured idle timeout as per the spec
Modified:
qpid/proton/trunk/proton-c/src/transport/transport.c
qpid/proton/trunk/tests/python/proton_tests/engine.py
Modified: qpid/proton/trunk/proton-c/src/transport/transport.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/transport/transport.c?rev=1570653&r1=1570652&r2=1570653&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/transport/transport.c (original)
+++ qpid/proton/trunk/proton-c/src/transport/transport.c Fri Feb 21 18:34:40 2014
@@ -1131,6 +1131,11 @@ int pn_process_conn_setup(pn_transport_t
{
if (!(endpoint->state & PN_LOCAL_UNINIT) && !transport->open_sent)
{
+ // as per the recommendation in the spec, advertise half our
+ // actual timeout to the remote
+ const pn_millis_t idle_timeout = transport->local_idle_timeout
+ ? (transport->local_idle_timeout/2)
+ : 0;
pn_connection_t *connection = (pn_connection_t *) endpoint;
const char *cid = pn_string_get(connection->container);
int err = pn_post_frame(transport->disp, 0, "DL[SS?I?H?InnCCC]", OPEN,
@@ -1139,7 +1144,7 @@ int pn_process_conn_setup(pn_transport_t
// if not zero, advertise our max frame size and idle timeout
(bool)transport->local_max_frame, transport->local_max_frame,
(bool)transport->channel_max, transport->channel_max,
- (bool)transport->local_idle_timeout, transport->local_idle_timeout,
+ (bool)idle_timeout, idle_timeout,
connection->offered_capabilities,
connection->desired_capabilities,
connection->properties);
Modified: qpid/proton/trunk/tests/python/proton_tests/engine.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/engine.py?rev=1570653&r1=1570652&r2=1570653&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/engine.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/engine.py Fri Feb 21 18:34:40 2014
@@ -880,10 +880,11 @@ class IdleTimeoutTest(Test):
self.snd.open()
self.rcv.open()
self.pump()
+ # proton advertises 1/2 the configured timeout to the peer:
assert self.rcv.session.connection._transport.idle_timeout == 2.0
- assert self.rcv.session.connection._transport.remote_idle_timeout == 1.0
+ assert self.rcv.session.connection._transport.remote_idle_timeout == 0.5
assert self.snd.session.connection._transport.idle_timeout == 1.0
- assert self.snd.session.connection._transport.remote_idle_timeout == 2.0
+ assert self.snd.session.connection._transport.remote_idle_timeout == 1.0
def testTimeout(self):
"""
@@ -901,7 +902,8 @@ class IdleTimeoutTest(Test):
t_snd = self.snd.session.connection._transport
t_rcv = self.rcv.session.connection._transport
assert t_rcv.idle_timeout == 0.0
- assert t_rcv.remote_idle_timeout == 1.0
+ # proton advertises 1/2 the timeout (see spec)
+ assert t_rcv.remote_idle_timeout == 0.5
assert t_snd.idle_timeout == 1.0
assert t_snd.remote_idle_timeout == 0.0
@@ -911,21 +913,21 @@ class IdleTimeoutTest(Test):
# at t+1msec, nothing should happen:
clock = 0.001
assert t_snd.tick(clock) == 1.001, "deadline for remote timeout"
- assert t_rcv.tick(clock) == 0.501, "deadline to send keepalive"
+ assert t_rcv.tick(clock) == 0.251, "deadline to send keepalive"
self.pump()
assert sndr_frames_in == t_snd.frames_input, "unexpected received frame"
# at one tick from expected idle frame send, nothing should happen:
- clock = 0.500
+ clock = 0.250
assert t_snd.tick(clock) == 1.001, "deadline for remote timeout"
- assert t_rcv.tick(clock) == 0.501, "deadline to send keepalive"
+ assert t_rcv.tick(clock) == 0.251, "deadline to send keepalive"
self.pump()
assert sndr_frames_in == t_snd.frames_input, "unexpected received frame"
# this should cause rcvr to expire and send a keepalive
- clock = 0.502
+ clock = 0.251
assert t_snd.tick(clock) == 1.001, "deadline for remote timeout"
- assert t_rcv.tick(clock) == 1.002, "deadline to send keepalive"
+ assert t_rcv.tick(clock) == 0.501, "deadline to send keepalive"
self.pump()
sndr_frames_in += 1
rcvr_frames_out += 1
@@ -934,14 +936,14 @@ class IdleTimeoutTest(Test):
# since a keepalive was received, sndr will rebase its clock against this tick:
# and the receiver should not change its deadline
- clock = 0.503
- assert t_snd.tick(clock) == 1.503, "deadline for remote timeout"
- assert t_rcv.tick(clock) == 1.002, "deadline to send keepalive"
+ clock = 0.498
+ assert t_snd.tick(clock) == 1.498, "deadline for remote timeout"
+ assert t_rcv.tick(clock) == 0.501, "deadline to send keepalive"
self.pump()
assert sndr_frames_in == t_snd.frames_input, "unexpected received frame"
# now expire sndr
- clock = 1.504
+ clock = 1.499
t_snd.tick(clock)
try:
self.pump()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org