<div dir="ltr"><div><div>add the ability to specify Spice keepalive</div><div><br></div><div>Signed-off-by: Sunny Shin <<a href="mailto:sunny4s.git@gmail.com">sunny4s.git@gmail.com</a>></div><div>---</div><div> qemu-options.hx |  4 ++++</div><div> ui/spice-core.c | 15 +++++++++++++++</div><div> 2 files changed, 19 insertions(+)</div><div><br></div><div>diff --git a/qemu-options.hx b/qemu-options.hx</div><div>index 0eea4ee..bc8fe42 100644</div><div>--- a/qemu-options.hx</div><div>+++ b/qemu-options.hx</div><div>@@ -995,6 +995,7 @@ DEF("spice", HAS_ARG, QEMU_OPTION_spice,</div><div>     "       [,streaming-video=[off|all|filter]][,disable-copy-paste]\n"</div><div>     "       [,disable-agent-file-xfer][,agent-mouse=[on|off]]\n"</div><div>     "       [,playback-compression=[on|off]][,seamless-migration=[on|off]]\n"</div><div>+    "       [,keepalive-timeout=<timeout>]\n"</div><div>     "   enable spice\n"</div><div>     "   at least one of {port, tls-port} is mandatory\n",</div><div>     QEMU_ARCH_ALL)</div><div>@@ -1086,6 +1087,9 @@ Enable/disable audio stream compression (using celt 0.5.1).  Default is on.</div><div> @item seamless-migration=[on|off]</div><div> Enable/disable spice seamless migration. Default is off.</div><div><br></div><div>+@item keepalive-timeout=[<timeout>]</div><div>+Enable tcp keepalive and set timeout as specified value.</div><div>+</div><div> @end table</div><div> ETEXI</div><div><br></div><div><div>diff --git a/ui/spice-core.c b/ui/spice-core.c</div><div>index 6a62d71..1ffff9b 100644</div><div>--- a/ui/spice-core.c</div><div>+++ b/ui/spice-core.c</div><div>@@ -496,6 +496,9 @@ static QemuOptsList qemu_spice_opts = {</div><div>         }, {</div><div>             .name = "seamless-migration",</div><div>             .type = QEMU_OPT_BOOL,</div><div>+        }, {</div><div>+            .name = "keepalive-timeout",</div><div>+            .type = QEMU_OPT_NUMBER,</div><div>         },</div><div>         { /* end of list */ }</div><div>     },</div><div>@@ -644,6 +647,7 @@ void qemu_spice_init(void)</div><div>     spice_image_compression_t compression;</div><div>     spice_wan_compression_t wan_compr;</div><div>     bool seamless_migration;</div><div>+    int keepalive_timeout;</div><div><br></div><div>     qemu_thread_get_self(&me);</div><div><br></div><div>@@ -794,6 +798,17 @@ void qemu_spice_init(void)</div><div><br></div><div>     seamless_migration = qemu_opt_get_bool(opts, "seamless-migration", 0);</div><div>     spice_server_set_seamless_migration(spice_server, seamless_migration);</div><div>+</div><div>+    keepalive_timeout = qemu_opt_get_number(opts, "keepalive-timeout", 0);</div><div>+    if (keepalive_timeout > 0) {</div><div>+#if SPICE_SERVER_VERSION >= 0x000c06</div><div>+        spice_server_set_keepalive_timeout(spice_server, keepalive_timeout);</div><div>+#else</div><div>+        error_report("this qemu build does not support the "</div><div>+                     "\"keepalive-timeout\" option");</div><div>+#endif</div><div>+    }</div><div>+</div><div>     if (spice_server_init(spice_server, &core_interface) != 0) {</div><div>         error_report("failed to initialize spice server");</div><div>         exit(1);</div><div>--</div><div>2.5.0</div></div></div><div><br></div></div>