Skip to content

Read timeouts in fsmpico #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

saebischer
Copy link

Transfer of merge request !90 from GitLab.

This commit is a transfer of GitLab branch 88-read-timeouts-in-fsm.
Copy link
Member

@dettonijr dettonijr left a comment

Choose a reason for hiding this comment

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

The changes here will fail when merged with the tests... To fix you can cherry-pick this:
bbe200a

@@ -69,6 +69,8 @@

// Defines

#define READ_TIMEOUT (5000)
#define CONTINUOUS_TIMEOUT_LEEWAY (1000)
Copy link
Member

Choose a reason for hiding this comment

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

Can we unify those two constants in a single leeway? They seem to have similar semantics.

src/fsmpico.c Outdated
LOG(LOG_DEBUG, "Reconnecting for continuous authentication");
fsmpico->comms->reconnect(fsmpico->user_data);
break;
case FSMPICOSTATE_PICOREAUTH:
createMessagePicoReauth(fsmpico, message, extraData);
fsmpico->comms->write(buffer_get_buffer(message), buffer_get_pos(message), fsmpico->user_data);
stateTransition(fsmpico, FSMPICOSTATE_SERVICEREAUTH);
// set a timeout for awaiting a response
fsmpico->comms->setTimeout(fsmpico->reauthDelay + CONTINUOUS_TIMEOUT_LEEWAY, fsmpico->user_data);
Copy link
Member

Choose a reason for hiding this comment

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

There is some inconsistence in this timeout.

Service sends reauth 10 seconds
Pico replies back and set a timeout to 10s + LEEWAY
Service sends reauth 10 seconds
Pico waits for 10 seconds
Pico replies back and set a timeout to 10s + LEEWAY

The timeouts should expire in the same point in time.

Remove the timeout between reading a ServiceReauth message and sending the PicoReauth message.
@@ -364,6 +372,8 @@ void fsmpico_read(FsmPico * fsmpico, char const * data, size_t length) {
createMessagePicoAuth(fsmpico, message, fsmpico->extraData);
fsmpico->comms->write(buffer_get_buffer(message), buffer_get_pos(message), fsmpico->user_data);
stateTransition(fsmpico, FSMPICOSTATE_STATUS);
// set a timeout for waiting for the status message
fsmpico->comms->setTimeout(READ_TIMEOUT, fsmpico->user_data);
Copy link
Member

Choose a reason for hiding this comment

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

To match the pattern of fsmservice, the timeout on connect is sufficient. This timeout should be removed, unless there's a good reason for it that I'm missing?

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.

3 participants