Skip to content

Commit

Permalink
Update last_known_tag to FOREVER when an input connection closes
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj committed Nov 6, 2024
1 parent 93e3fc1 commit a732fb1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/reactor-uc/network_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ typedef struct NetworkChannel NetworkChannel;

struct NetworkChannel {
size_t dest_channel_id; // So that we can "address" one of several NetworkChannel's at the other end.

lf_ret_t (*open_connection)(NetworkChannel *self);

/** Try to connect to corresponding NetworkChannel on another federate.
Expand Down
2 changes: 2 additions & 0 deletions src/federated.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ void FederatedOutputConnection_cleanup(Trigger *trigger) {
tagged_msg->tag.microstep);
lf_ret_t ret = channel->send_blocking(channel, &msg);

// TODO: If send_blocking returns LF_CONNECTION_CLOSEd then we should update some state
// and not try again.
if (ret != LF_OK) {
LF_ERR(FED, "FedOutConn %p failed to send message", trigger);
}
Expand Down
6 changes: 5 additions & 1 deletion src/platform/posix/tcp_ip_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,11 @@ static void *TcpIpChannel_receive_thread(void *untyped_self) {
self->receive_callback(self->federated_connection, &self->output);
break;
case LF_CONNECTION_CLOSED:
LF_INFO(NET, "Connection closed");
LF_INFO(NET, "Connection closed. Setting last known tag to FOREVER for all input ports");
for (int i = 0; i < self->federated_connection->inputs_size; i++) {
FederatedInputConnection *input = self->federated_connection->inputs[i];
input->last_known_tag = FOREVER_TAG;
}
self->terminate = true;
break;
default:
Expand Down

0 comments on commit a732fb1

Please sign in to comment.