VCM-RR* protocols
This commit is contained in:
parent
067d727591
commit
7285772fc3
12
src/config.c
12
src/config.c
|
|
@ -356,12 +356,14 @@ int facilities_config() {
|
|||
|
||||
// MCM
|
||||
facilities.coordination.active = config->facilities.mcm.activate;
|
||||
if (!strcmp("vcm-reqrep", config->facilities.mcm.protocol)) {
|
||||
facilities.coordination.protocol = MC_PROTOCOL_REQ_REP;
|
||||
} else if (!strcmp("vcm-reqrepcom", config->facilities.mcm.protocol)) {
|
||||
facilities.coordination.protocol = MC_PROTOCOL_REQ_REP_COM;
|
||||
if (!strcmp("vcm-RR", config->facilities.mcm.protocol)) {
|
||||
facilities.coordination.protocol = MC_PROTOCOL_VCM_RR;
|
||||
} else if (!strcmp("vcm-RR1C", config->facilities.mcm.protocol)) {
|
||||
facilities.coordination.protocol = MC_PROTOCOL_VCM_RR1C;
|
||||
} else if (!strcmp("vcm-RRAC", config->facilities.mcm.protocol)) {
|
||||
facilities.coordination.protocol = MC_PROTOCOL_VCM_RRAC;
|
||||
} else {
|
||||
facilities.coordination.protocol = MC_PROTOCOL_REQ_REP;
|
||||
facilities.coordination.protocol = MC_PROTOCOL_VCM_RR;
|
||||
}
|
||||
facilities.coordination.vcm_period_min = config->facilities.mcm.period_min;
|
||||
facilities.coordination.vcm_period_max = config->facilities.mcm.period_max;
|
||||
|
|
|
|||
18
src/vcm.c
18
src/vcm.c
|
|
@ -273,11 +273,14 @@ static void session_cleanup() {
|
|||
static bool commit() {
|
||||
coordination_t* coordination = &facilities.coordination;
|
||||
|
||||
if (coordination->protocol == MC_PROTOCOL_REQ_REP) {
|
||||
if (!is_maneuver_approved()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_maneuver_approved()) {
|
||||
/* do not send commit if in RR1C and ego not requester */
|
||||
if (coordination->protocol == MC_PROTOCOL_VCM_RR1C &&
|
||||
!coordination->session.own_req) {
|
||||
session_cleanup();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -339,7 +342,6 @@ static bool commit() {
|
|||
|
||||
tx_vcm(vcm_com);
|
||||
ASN_STRUCT_FREE(asn_DEF_VCM, vcm_com);
|
||||
log_warn("SENDING COMMIT");
|
||||
|
||||
session_cleanup();
|
||||
|
||||
|
|
@ -555,7 +557,9 @@ static int vcm_check_handle_request(VCM_t* vcm, mc_neighbour_s* neighbour) {
|
|||
}
|
||||
}
|
||||
|
||||
commit();
|
||||
if (coordination->protocol != MC_PROTOCOL_VCM_RR) {
|
||||
commit();
|
||||
}
|
||||
|
||||
cleanup:
|
||||
ASN_STRUCT_FREE(asn_DEF_VCM, vcm_rep);
|
||||
|
|
@ -604,7 +608,7 @@ static int vcm_check_handle_reply(VCM_t* vcm, mc_neighbour_s* neighbour) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (coordination->protocol == MC_PROTOCOL_REQ_REP) {
|
||||
if (coordination->protocol == MC_PROTOCOL_VCM_RR) {
|
||||
session_cleanup();
|
||||
}
|
||||
|
||||
|
|
@ -648,12 +652,12 @@ static int vcm_check_handle_reply(VCM_t* vcm, mc_neighbour_s* neighbour) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (coordination->protocol == MC_PROTOCOL_REQ_REP) {
|
||||
if (coordination->protocol == MC_PROTOCOL_VCM_RR) {
|
||||
session_cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
if (coordination->protocol != MC_PROTOCOL_REQ_REP) {
|
||||
if (coordination->protocol != MC_PROTOCOL_VCM_RR) {
|
||||
commit();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue