Skip to content

Commit

Permalink
[C] Use separate variable for disabling status messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeb01 committed Nov 13, 2024
1 parent 39f0503 commit e8b35e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions aeron-driver/src/main/c/aeron_publication_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ int aeron_publication_image_create(
_image->last_overrun_threshold = initial_position + (term_buffer_length / 2);
_image->time_of_last_packet_ns = now_ns;
_image->next_sm_deadline_ns = 0;
_image->is_sm_enabled = true;
_image->conductor_fields.clean_position = initial_position;
_image->conductor_fields.time_of_last_state_change_ns = now_ns;

Expand Down Expand Up @@ -703,7 +704,7 @@ int aeron_publication_image_send_pending_status_message(aeron_publication_image_
int work_count = 0;
int64_t change_number;
AERON_GET_ACQUIRE(change_number, image->end_sm_change);
const bool has_sm_timed_out = now_ns > image->next_sm_deadline_ns;
const bool has_sm_timed_out = image->is_sm_enabled && image->next_sm_deadline_ns < now_ns;

if (NULL != image->invalidation_reason)
{
Expand Down Expand Up @@ -1153,7 +1154,7 @@ void aeron_publication_image_stop_status_messages_if_not_active(aeron_publicatio
{
if (AERON_PUBLICATION_IMAGE_STATE_ACTIVE != image->conductor_fields.state)
{
image->next_sm_deadline_ns = INT64_MAX;
image->is_sm_enabled = false;
}
}

Expand Down
2 changes: 2 additions & 0 deletions aeron-driver/src/main/c/aeron_publication_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ typedef struct aeron_publication_image_stct
int64_t time_of_last_packet_ns;
const char *invalidation_reason;

bool is_sm_enabled;

volatile int64_t response_session_id;

volatile bool is_end_of_stream;
Expand Down

0 comments on commit e8b35e9

Please sign in to comment.