Skip to content

Conversation

@dettonijr
Copy link
Member

@dettonijr dettonijr commented Feb 1, 2018

This adds changes to the FsmService and FsmPico state machines in two ways:

  1. 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_data

  2. I 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

Seb Aebischer and others added 10 commits January 29, 2018 17:08
This commit is a transfer of GitLab branch 88-read-timeouts-in-fsm.
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.
buffer_delete(messageservicereauth->encryptedData);
}

buffer_delete(messageservicereauth->extraData);
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

@llewelld llewelld left a 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);
Copy link
Member

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.

Copy link
Member

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)
Copy link
Member

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.

Copy link
Member

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.

@llewelld
Copy link
Member

I've added #11 for these changes to be reflected in the blocking channel versions of the continuous functions.

Copy link
Member

@llewelld llewelld left a 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

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