[gnome-builder] langserv-client: send shutdown request when stopping



commit 752351467a385e4a5cb1da63ee44ad3d5b33606e
Author: Christian Hergert <chergert redhat com>
Date:   Mon Oct 24 17:30:36 2016 -0700

    langserv-client: send shutdown request when stopping

 libide/langserv/ide-langserv-client.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/libide/langserv/ide-langserv-client.c b/libide/langserv/ide-langserv-client.c
index 64c0de0..fa671aa 100644
--- a/libide/langserv/ide-langserv-client.c
+++ b/libide/langserv/ide-langserv-client.c
@@ -842,6 +842,24 @@ ide_langserv_client_start (IdeLangservClient *self)
   IDE_EXIT;
 }
 
+static void
+ide_langserv_client_shutdown_cb (GObject      *object,
+                                 GAsyncResult *result,
+                                 gpointer      user_data)
+{
+  JsonrpcClient *client = (JsonrpcClient *)object;
+  g_autoptr(GError) error = NULL;
+
+  IDE_ENTRY;
+
+  if (!jsonrpc_client_call_finish (client, result, NULL, &error))
+    g_warning ("%s", error->message);
+
+  jsonrpc_client_close_async (client, NULL, NULL, NULL);
+
+  IDE_EXIT;
+}
+
 void
 ide_langserv_client_stop (IdeLangservClient *self)
 {
@@ -853,7 +871,12 @@ ide_langserv_client_stop (IdeLangservClient *self)
 
   if (priv->rpc_client != NULL)
     {
-      jsonrpc_client_close_async (priv->rpc_client, NULL, NULL, NULL);
+      jsonrpc_client_call_async (priv->rpc_client,
+                                 "shutdown",
+                                 NULL,
+                                 NULL,
+                                 ide_langserv_client_shutdown_cb,
+                                 NULL);
       g_clear_object (&priv->rpc_client);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]