lib: mgmtd: session create and destroy both short-circuit

For creation this is the first thing done so short-circuit just means inline
sync response. However, for destroy there could be commands in-flight, these
will be discarded when they match no session, and the state cleaned up
immediately when the message short-circuits.

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 0fc08fa738)
This commit is contained in:
Christian Hopps 2023-06-11 22:13:48 -04:00 committed by Mergify
parent c874d567cc
commit 58c7dd98d2

View File

@ -124,18 +124,15 @@ static int mgmt_fe_send_session_req(struct mgmt_fe_client *client,
{ {
Mgmtd__FeMessage fe_msg; Mgmtd__FeMessage fe_msg;
Mgmtd__FeSessionReq sess_req; Mgmtd__FeSessionReq sess_req;
bool scok;
mgmtd__fe_session_req__init(&sess_req); mgmtd__fe_session_req__init(&sess_req);
sess_req.create = create; sess_req.create = create;
if (create) { if (create) {
sess_req.id_case = MGMTD__FE_SESSION_REQ__ID_CLIENT_CONN_ID; sess_req.id_case = MGMTD__FE_SESSION_REQ__ID_CLIENT_CONN_ID;
sess_req.client_conn_id = session->client_id; sess_req.client_conn_id = session->client_id;
scok = true;
} else { } else {
sess_req.id_case = MGMTD__FE_SESSION_REQ__ID_SESSION_ID; sess_req.id_case = MGMTD__FE_SESSION_REQ__ID_SESSION_ID;
sess_req.session_id = session->session_id; sess_req.session_id = session->session_id;
scok = false;
} }
mgmtd__fe_message__init(&fe_msg); mgmtd__fe_message__init(&fe_msg);
@ -146,7 +143,7 @@ static int mgmt_fe_send_session_req(struct mgmt_fe_client *client,
"Sending SESSION_REQ %s message for client-id %" PRIu64, "Sending SESSION_REQ %s message for client-id %" PRIu64,
create ? "create" : "destroy", session->client_id); create ? "create" : "destroy", session->client_id);
return mgmt_fe_client_send_msg(client, &fe_msg, scok); return mgmt_fe_client_send_msg(client, &fe_msg, true);
} }
int mgmt_fe_send_lockds_req(struct mgmt_fe_client *client, uint64_t session_id, int mgmt_fe_send_lockds_req(struct mgmt_fe_client *client, uint64_t session_id,