-
Notifications
You must be signed in to change notification settings - Fork 2
Support messages in during continuous #8
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
base: master
Are you sure you want to change the base?
Conversation
This commit is a transfer of GitLab branch 88-read-timeouts-in-fsm.
…-messages-in-continuous
…-support-messages-in-continuous
… 6-support-messages-in-continuous
I added the functionality of having an extra data to the service reauth message in a similar fashion as the pico reauth message It was implemented in a way that previous messages still work, so it is not breaking compatibility
This was in a similar way to what already existed on fsmservice
Remove the timeout between reading a ServiceReauth message and sending the PicoReauth message.
…-support-messages-in-continuous
src/messageservicereauth.c
Outdated
| buffer_delete(messageservicereauth->encryptedData); | ||
| } | ||
|
|
||
| buffer_delete(messageservicereauth->extraData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be wrapped with a NULL check, and set to NULL after deletion.
if (messageservicereauth->extraData) {
buffer_delete(messageservicereauth->extraData);
messageservicereauth->extraData = NULL;
}
So should all of the other pointers in the messageservicereauth_delete function. This must have been an earlier error on my part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraData is created in messageservicereauth_new so it will always be there, there is no need to check.
Is there a point in setting to NULL if the whole thing will be freed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's defensive, clean and consistent. If changes to other parts of the code mean it gets freed elsewhere, assuming it's done cleanly (i.e. NULL-ed afterwards), then this code will remain valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed that and changed for the other attributes as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment moved to reply
| buffer_append_lengthprepend(toEncrypt, sequencenumber_get_raw_bytes(messageservicereauth->sequenceNum), SEQUENCE_NUMBER_LENGTH); | ||
|
|
||
| // Extra data | ||
| buffer_append_buffer_lengthprepend(toEncrypt, messageservicereauth->extraData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs adding in to jpico too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created mypico/jpico#1 for this.
| result = false; | ||
| } | ||
|
|
||
| // length | char extraData[length] (optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, jpico needs support for this too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created mypico/jpico#1 for this.
…' into 6-support-messages-in-continuous
|
I've added #11 for these changes to be reflected in the blocking channel versions of the continuous functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks fine. I created a couple of issues for these changes to be copied over to jpico and the blocking version of the continuous cycle.
See mypico/jpico#1 and #11
This adds changes to the FsmService and FsmPico state machines in two ways:
It is possible now to set/receive extra data on FsmPico. I don't particularly like the way this is implemented, but I basically copied as it was already done on FsmService.
In my opinion it would make more sense to get the data in callbacks instead of
get_outbound_extra_dataI added a new function on both state machines to force to send a reauthentication message. This way, the extra data can be sent without waiting for the next cycle.
This branch contains all of these (unfortunately they were all essential to implement this), so please merge them first:
#3
#4
#2