return mgmt_sessions_count(&client->sessions);
}
+bool mgmt_fe_client_current_msg_short_circuit(struct mgmt_fe_client *client)
+{
+ return client->client.conn.is_short_circuit;
+}
+
/*
* Create a new Session for a Frontend Client connection.
*/
*/
extern uint mgmt_fe_client_session_count(struct mgmt_fe_client *client);
+/*
+ * True if the current handled message is being short-circuited
+ */
+extern bool
+mgmt_fe_client_current_msg_short_circuit(struct mgmt_fe_client *client);
+
#ifdef __cplusplus
}
#endif
char *errmsg_if_any)
{
struct vty *vty;
+ bool is_short_circuit = mgmt_fe_client_current_msg_short_circuit(client);
vty = (struct vty *)session_ctx;
vty->mgmt_locked_running_ds = lock_ds;
}
- if (vty->mgmt_req_pending_cmd)
+ if (!is_short_circuit && vty->mgmt_req_pending_cmd) {
+ assert(!strcmp(vty->mgmt_req_pending_cmd, "MESSAGE_LOCKDS_REQ"));
vty_mgmt_resume_response(vty, success);
+ }
}
static void vty_mgmt_set_config_result_notified(
} else if (vty_mgmt_lock_running_inline(vty)) {
vty_out(vty,
"%% command failed, could not lock running DS\n");
+ vty_mgmt_unlock_candidate_inline(vty);
return -1;
}
}
}
if (lockds_req->lock) {
- if (mgmt_fe_session_write_lock_ds(lockds_req->ds_id,
- ds_ctx, session)
- != 0) {
+ if (mgmt_fe_session_write_lock_ds(lockds_req->ds_id, ds_ctx,
+ session)) {
fe_adapter_send_lockds_reply(
session, lockds_req->ds_id, lockds_req->req_id,
lockds_req->lock, false,
if (vty->node == CONFIG_NODE) {
/* resync in case one of the daemons is somewhere else */
vtysh_execute("end");
+ /* NOTE: a rather expensive thing to do, can we avoid it? */
vtysh_execute("configure terminal file-lock");
}
return CMD_SUCCESS;