[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 31/38] qmp: add qmp_return_is_cancelled()
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v3 31/38] qmp: add qmp_return_is_cancelled() |
Date: |
Mon, 26 Mar 2018 17:09:09 +0200 |
If the client is gone, and the session finished, no need to
return. The async handler can use this information to avoid
unnecessary work and exit earlier.
Signed-off-by: Marc-André Lureau <address@hidden>
---
include/qapi/qmp/dispatch.h | 8 ++++++++
qapi/qmp-dispatch.c | 10 ++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h
index e426317346..6ee82371a2 100644
--- a/include/qapi/qmp/dispatch.h
+++ b/include/qapi/qmp/dispatch.h
@@ -91,6 +91,14 @@ void qmp_return_free(QmpReturn *qret);
void qmp_return(QmpReturn *qret, QObject *rsp);
void qmp_return_error(QmpReturn *qret, Error *err);
+/*
+ * @qmp_return_is_cancelled:
+ *
+ * Return true if the QmpReturn is cancelled, and free the QmpReturn
+ * in this case.
+ */
+bool qmp_return_is_cancelled(QmpReturn *qret);
+
void qmp_register_command(QmpCommandList *cmds, const char *name,
QmpCommandFunc *fn, QmpCommandOptions options);
void qmp_register_async_command(QmpCommandList *cmds, const char *name,
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index f7d9931734..99f5128170 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -63,6 +63,16 @@ void qmp_return_free(QmpReturn *qret)
}
}
+bool qmp_return_is_cancelled(QmpReturn *qret)
+{
+ if (!qret->session) {
+ qmp_return_free(qret);
+ return true;
+ }
+
+ return false;
+}
+
static void qmp_return_orderly(QmpReturn *qret)
{
QmpSession *session = qret->session;
--
2.17.0.rc1.1.g4c4f2b46a3
- [Qemu-devel] [PATCH v3 21/38] QmpSession: add a dispatch callback, (continued)
- [Qemu-devel] [PATCH v3 21/38] QmpSession: add a dispatch callback, Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 22/38] monitor: use QmpSession parsing and common dispatch code, Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 24/38] qmp: remove qmp_build_error_object(), Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 23/38] QmpSession: introduce QmpReturn, Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 26/38] qmp: fold do_qmp_dispatch() in qmp_dispatch(), Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 27/38] QmpSession: keep a queue of pending commands, Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 25/38] qmp: remove need for qobject_from_jsonf(), Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 28/38] QmpSession: return orderly, Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 30/38] scripts: learn 'async' qapi commands, Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 29/38] qmp: introduce asynchronous command type, Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 31/38] qmp: add qmp_return_is_cancelled(),
Marc-André Lureau <=
- [Qemu-devel] [PATCH v3 33/38] console: graphic_hw_update return true if async, Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 34/38] console: add graphic_hw_update_done(), Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 35/38] console: make screendump asynchronous, Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 36/38] monitor: start making qmp_human_monitor_command() asynchronous, Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 32/38] monitor: add qmp_return_get_monitor(), Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 37/38] monitor: teach HMP about asynchronous commands, Marc-André Lureau, 2018/03/26
- [Qemu-devel] [PATCH v3 38/38] hmp: call the asynchronous QMP screendump to fix outdated/glitches, Marc-André Lureau, 2018/03/26
- Re: [Qemu-devel] [PATCH v3 00/38] RFC: monitor: add asynchronous command type, Dr. David Alan Gilbert, 2018/03/26
- Re: [Qemu-devel] [PATCH v3 00/38] RFC: monitor: add asynchronous command type, no-reply, 2018/03/26