Skip to content

Implement primary hub reconnection logic when connected to failover hub#1381

Open
skarg wants to merge 1 commit into
masterfrom
feature/bacnet-sc-retry-primary-hub-when-connected-to-failover-hub
Open

Implement primary hub reconnection logic when connected to failover hub#1381
skarg wants to merge 1 commit into
masterfrom
feature/bacnet-sc-retry-primary-hub-when-connected-to-failover-hub

Conversation

@skarg

@skarg skarg commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements BACnet/SC hub connector behavior to retry reconnecting to the primary hub while remaining connected to a failover hub, and updates the corresponding reconnection test to validate this behavior.

Changes:

  • Add primary-retry scheduling/handling while in CONNECTED_FAILOVER.
  • Extend hub-connector socket event handling to support restoring primary while failover is active.
  • Update the hub-sc reconnection test to keep failover running while primary is restored.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/bacnet/datalink/bsc/bsc-hub-connector.c Adds state-machine logic to attempt primary reconnection while connected to failover, plus related socket-event handling.
test/bacnet/datalink/hub-sc/src/main.c Adjusts reconnection test ordering to ensure primary restore is retried while failover remains connected.

Comment on lines +181 to +185
if (ret == BSC_SC_SUCCESS) {
hc->state = BSC_HUB_CONNECTOR_STATE_CONNECTING_PRIMARY_FROM_FAILOVER;
} else {
hub_connector_schedule_primary_retry(hc);
}
Comment on lines +322 to +325
} else if (
sock_type == BSC_HUB_CONN_PRIMARY &&
hc->state ==
BSC_HUB_CONNECTOR_STATE_CONNECTING_PRIMARY_FROM_FAILOVER) {
Comment on lines +420 to +422
bws_dispatch_unlock();
DEBUG_PRINTF("hub_connector_socket_event() <<<\n");
return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BACnet SC does not retry a connection to the primary hub when connected to the failover hub

2 participants