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
|
// MCM
|
||||||
facilities.coordination.active = config->facilities.mcm.activate;
|
facilities.coordination.active = config->facilities.mcm.activate;
|
||||||
if (!strcmp("vcm-reqrep", config->facilities.mcm.protocol)) {
|
if (!strcmp("vcm-RR", config->facilities.mcm.protocol)) {
|
||||||
facilities.coordination.protocol = MC_PROTOCOL_REQ_REP;
|
facilities.coordination.protocol = MC_PROTOCOL_VCM_RR;
|
||||||
} else if (!strcmp("vcm-reqrepcom", config->facilities.mcm.protocol)) {
|
} else if (!strcmp("vcm-RR1C", config->facilities.mcm.protocol)) {
|
||||||
facilities.coordination.protocol = MC_PROTOCOL_REQ_REP_COM;
|
facilities.coordination.protocol = MC_PROTOCOL_VCM_RR1C;
|
||||||
|
} else if (!strcmp("vcm-RRAC", config->facilities.mcm.protocol)) {
|
||||||
|
facilities.coordination.protocol = MC_PROTOCOL_VCM_RRAC;
|
||||||
} else {
|
} 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_min = config->facilities.mcm.period_min;
|
||||||
facilities.coordination.vcm_period_max = config->facilities.mcm.period_max;
|
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() {
|
static bool commit() {
|
||||||
coordination_t* coordination = &facilities.coordination;
|
coordination_t* coordination = &facilities.coordination;
|
||||||
|
|
||||||
if (coordination->protocol == MC_PROTOCOL_REQ_REP) {
|
if (!is_maneuver_approved()) {
|
||||||
return false;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -339,7 +342,6 @@ static bool commit() {
|
||||||
|
|
||||||
tx_vcm(vcm_com);
|
tx_vcm(vcm_com);
|
||||||
ASN_STRUCT_FREE(asn_DEF_VCM, vcm_com);
|
ASN_STRUCT_FREE(asn_DEF_VCM, vcm_com);
|
||||||
log_warn("SENDING COMMIT");
|
|
||||||
|
|
||||||
session_cleanup();
|
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:
|
cleanup:
|
||||||
ASN_STRUCT_FREE(asn_DEF_VCM, vcm_rep);
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coordination->protocol == MC_PROTOCOL_REQ_REP) {
|
if (coordination->protocol == MC_PROTOCOL_VCM_RR) {
|
||||||
session_cleanup();
|
session_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -648,12 +652,12 @@ static int vcm_check_handle_reply(VCM_t* vcm, mc_neighbour_s* neighbour) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coordination->protocol == MC_PROTOCOL_REQ_REP) {
|
if (coordination->protocol == MC_PROTOCOL_VCM_RR) {
|
||||||
session_cleanup();
|
session_cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coordination->protocol != MC_PROTOCOL_REQ_REP) {
|
if (coordination->protocol != MC_PROTOCOL_VCM_RR) {
|
||||||
commit();
|
commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,9 @@
|
||||||
#define MC_SESSIONS_N_MAX 16
|
#define MC_SESSIONS_N_MAX 16
|
||||||
|
|
||||||
typedef enum MC_PROTOCOL {
|
typedef enum MC_PROTOCOL {
|
||||||
MC_PROTOCOL_REQ_REP,
|
MC_PROTOCOL_VCM_RR,
|
||||||
MC_PROTOCOL_REQ_REP_COM
|
MC_PROTOCOL_VCM_RR1C,
|
||||||
|
MC_PROTOCOL_VCM_RRAC
|
||||||
} MC_PROTOCOL_e;
|
} MC_PROTOCOL_e;
|
||||||
|
|
||||||
typedef struct mc_neighbour {
|
typedef struct mc_neighbour {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue