Skip to content
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

Split connection state machines #120

Merged
merged 3 commits into from
Sep 30, 2020
Merged

Conversation

Patrik-Stas
Copy link
Contributor

@Patrik-Stas Patrik-Stas commented Sep 28, 2020

Created this as separate PR into v3/restructure-files to make these changes easier to digest.

  • Splits DidExchangeStateSM state machine into 2 separate state machines for inviter and invitee
  • Updated mocks of serialized connections (aligned with recent changes to agent info, updated to 3.0 serialization format
  • Added tests for serialization/deserialization
  • File v3/handlers/connection/connection.rs serves as proxy interface to preserve shared inviter/invitee interface.
  • Modifies behaviour of get_invite_details. It returns connection invitation only if called on inviter connection in state Invited. Otherwise returns error. Previously the code was attempting to construct invitation object from DDO of connection counterparty known at the moment.
  • calling connect() on connection now returns connection invitation if the connection is inviter, otherwise returns string {}

Signed-off-by: Patrik Stas patrik.stas@absa.africa

libvcx/src/connection.rs Outdated Show resolved Hide resolved
@Patrik-Stas Patrik-Stas force-pushed the connection-split branch 2 times, most recently from f6c39dd to fc233c8 Compare September 29, 2020 07:55
Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
Comment on lines +281 to +288
} else if let SmConnection::Inviter(sm_inviter) = &self.connection_sm {
trace!("Connection::update_state >>> Inviter found no message to handel on main connection agent. Will check bootstrap agent.");
if let Some((messages, bootstrap_agent_info)) = sm_inviter.get_bootstrap_agent_messages()? {
if let Some((uid, message)) = self.find_message_to_handle(messages) {
trace!("Connection::update_state >>> handling message found on bootstrap agent uid: {:?}", uid);
self.update_state_with_message(&message);
bootstrap_agent_info.update_message_status(uid)?;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should add a one line comment explaining why this is done?

@@ -308,38 +308,30 @@ pub extern fn vcx_connection_connect(command_handle: CommandHandle,
return VcxError::from(VcxErrorKind::InvalidConnectionHandle).into();
}

let options = if !connection_options.is_null() {
let _options = if !connection_options.is_null() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this defined but not used?

@mirgee mirgee merged commit dc455f7 into v3/restructure-files Sep 30, 2020
@mirgee mirgee deleted the connection-split branch September 30, 2020 11:30
mirgee pushed a commit that referenced this pull request Oct 1, 2020
* Restructure connection state machine files

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Split connection state machines (#120)

* Split connection state machines files

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Inviter conn should also check bootstrap agent for messages. Refactor.

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Connection.connect returns invitation for inviter. Refactor

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Update access modifiers, removed redundant comments

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Remove unused imports in v3/**

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Optimize imports, reformat code

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Error in connection update state should not be ignored

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>

* Remove outdated test, fix warnings in connection.rs

Signed-off-by: Patrik Stas <patrik.stas@absa.africa>
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.

2 participants