summaryrefslogtreecommitdiff
path: root/librabbitmq/amqp_connection.c
diff options
context:
space:
mode:
authorAlan Antonuk <alan.antonuk@gmail.com>2013-06-26 10:17:33 -0700
committerAlan Antonuk <alan.antonuk@gmail.com>2013-06-26 10:17:33 -0700
commitee0a716ae8ccd6b1305c06b8a6211e8e95ab375b (patch)
treed19df8cc2a88f1a7b5b2f242fade6354d8b28f68 /librabbitmq/amqp_connection.c
parentaca5dc13c7ebce355f490b395ca3a57593348e84 (diff)
downloadrabbitmq-c-github-ask-ee0a716ae8ccd6b1305c06b8a6211e8e95ab375b.tar.gz
Code clarity improvements in heartbeat handling
Diffstat (limited to 'librabbitmq/amqp_connection.c')
-rw-r--r--librabbitmq/amqp_connection.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/librabbitmq/amqp_connection.c b/librabbitmq/amqp_connection.c
index 214dbec..d5c29b0 100644
--- a/librabbitmq/amqp_connection.c
+++ b/librabbitmq/amqp_connection.c
@@ -134,13 +134,13 @@ int amqp_tune_connection(amqp_connection_state_t state,
state->frame_max = frame_max;
state->heartbeat = heartbeat;
- if (state->heartbeat > 0) {
+ if (amqp_heartbeat_enabled(state)) {
uint64_t current_time = amqp_get_monotonic_timestamp();
if (0 == current_time) {
return AMQP_STATUS_TIMER_FAILURE;
}
- state->next_send_heartbeat = current_time + ((uint64_t)state->heartbeat * AMQP_NS_PER_S);
- state->next_recv_heartbeat = current_time + (2 * (uint64_t)state->heartbeat * AMQP_NS_PER_S);
+ state->next_send_heartbeat = amqp_calc_next_send_heartbeat(state, current_time);
+ state->next_recv_heartbeat = amqp_calc_next_recv_heartbeat(state, current_time);
}
state->outbound_buffer.len = frame_max;
@@ -506,7 +506,7 @@ int amqp_send_frame(amqp_connection_state_t state,
if (0 == current_time) {
return AMQP_STATUS_TIMER_FAILURE;
}
- state->next_send_heartbeat = current_time + (state->heartbeat * AMQP_NS_PER_S);
+ state->next_send_heartbeat = amqp_calc_next_send_heartbeat(state, current_time);
}
return res;