Skip to content

Commit

Permalink
Fixed state machine (await version)
Browse files Browse the repository at this point in the history
  • Loading branch information
lte678 committed Jan 5, 2024
1 parent 16c1646 commit 9fb31cf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/StateController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ namespace fmerge {
send_version();
break;
case State::SendTree:
LOG("Sending file tree" << std::endl);
send_filetree();
break;
case State::ResolvingConflicts:
do_merge();
Expand Down Expand Up @@ -128,7 +126,8 @@ namespace fmerge {
}
}

if(state == State::AwaitingVersion) state = State::SendTree;
state = State::SendTree;
c->send_message(std::make_shared<ExitingStateMessage>(State::AwaitingVersion));
}


Expand All @@ -140,6 +139,8 @@ namespace fmerge {
state_lock.unlock();

state = State::ResolvingConflicts;
} else {
LOG("[Warning] Received unexpected 'Changes' message from peer" << std::endl);
}
}

Expand Down Expand Up @@ -210,7 +211,8 @@ namespace fmerge {
} else if(msg->get_payload().state == State::AwaitingVersion) {
// The user accepted the version difference at the peer
term()->cancel_prompt();
LOG("Continuing (triggered by peer)..." << std::endl);
LOG("Sending file tree" << std::endl);
send_filetree();
} else {
std::cerr << "Error: Received unknown exit state message from peer" << std::endl;
}
Expand Down

0 comments on commit 9fb31cf

Please sign in to comment.