Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

D7AP: switch from SLAVE_PENDING_MASTER to MASTER instead of IDLE #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion stack/modules/d7ap/d7asp.c
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,18 @@ void d7asp_signal_dialog_terminated()
if (current_master_session.state == D7ASP_MASTER_SESSION_PENDING_DORMANT_TRIGGERED) {
switch_state(D7ASP_STATE_PENDING_MASTER);
schedule_current_session();
d7ap_stack_signal_slave_session_terminated();

} else if (d7asp_state == D7ASP_STATE_SLAVE_PENDING_MASTER) {
d7ap_stack_signal_slave_session_terminated();

switch_state(D7ASP_STATE_MASTER);
d7ap_stack_signal_active_master_session(current_master_session.token);
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I can see now, this if not necessary is we would switch to D7ASP_STATE_PENDING_MASTER here (which is also accurate now that the slave dialog is terminated) and then call schedule_current_session(), which would flush the fifo's, activate the master dialog and call d7ap_stack_signal_active_master_session().

It is then basically the same logic as in the if (current_master_session.state == D7ASP_MASTER_SESSION_PENDING_DORMANT_TRIGGERED) branch, so the condition can just be expanded to include the (d7asp_state == D7ASP_STATE_SLAVE_PENDING_MASTER) condition I think?

schedule_current_session();

} else {
switch_state(D7ASP_STATE_IDLE);
d7ap_stack_signal_slave_session_terminated();
}

d7ap_stack_signal_slave_session_terminated();
}