guest_server: added a sending suspend state after sdb server registers 61/11561/2
authorJinhyung Choi <jinhyung2.choi@samsung.com>
Wed, 30 Oct 2013 06:18:23 +0000 (15:18 +0900)
committerJinhyung Choi <jinhyung2.choi@samsung.com>
Wed, 30 Oct 2013 06:29:46 +0000 (15:29 +0900)
Change-Id: I303b143a329d43ba5f830d9301b5cc0ee0d70fb8
Signed-off-by: Jinhyung Choi <jinhyung2.choi@samsung.com>
tizen/src/guest_server.c

index 72782d8b86664f2cca95265c5ef779eca1a5e111..e2b0d44fdaa2e62fd801ea7715c00ef2be36661b 100644 (file)
@@ -53,6 +53,7 @@
 #include "sdb.h"
 #include "maru_common.h"
 #include "hw/maru_virtio_hwkey.h"
+#include "hw/maru_pm.h"
 
 MULTI_DEBUG_CHANNEL(qemu, guest_server);
 
@@ -76,34 +77,6 @@ clients = QTAILQ_HEAD_INITIALIZER(clients);
 
 static pthread_mutex_t mutex_clilist = PTHREAD_MUTEX_INITIALIZER;
 
-static void add_sdb_client(const char* addr, int port)
-{
-    GS_Client *client = g_malloc0(sizeof(GS_Client));
-    if (NULL == client) {
-        INFO("GS_Client allocation failed.\n");
-        return;
-    }
-
-    if (addr == NULL || strlen(addr) <= 0) {
-        INFO("GS_Client client's address is EMPTY.\n");
-        return;
-    } else if (strlen(addr) > RECV_BUF_SIZE) {
-        INFO("GS_Client client's address is too long. %s\n", addr);
-        return;
-    }
-
-    strcpy(client->addr, addr);
-    client->port = port;
-
-    pthread_mutex_lock(&mutex_clilist);
-
-    QTAILQ_INSERT_TAIL(&clients, client, next);
-
-    pthread_mutex_unlock(&mutex_clilist);
-
-    INFO("Added new sdb client. ip: %s, port: %d\n", client->addr, client->port);
-}
-
 static void remove_sdb_client(GS_Client* client)
 {
     if (client == NULL) {
@@ -164,6 +137,36 @@ void notify_all_sdb_clients(int state)
 
 }
 
+static void add_sdb_client(const char* addr, int port)
+{
+    GS_Client *client = g_malloc0(sizeof(GS_Client));
+    if (NULL == client) {
+        INFO("GS_Client allocation failed.\n");
+        return;
+    }
+
+    if (addr == NULL || strlen(addr) <= 0) {
+        INFO("GS_Client client's address is EMPTY.\n");
+        return;
+    } else if (strlen(addr) > RECV_BUF_SIZE) {
+        INFO("GS_Client client's address is too long. %s\n", addr);
+        return;
+    }
+
+    strcpy(client->addr, addr);
+    client->port = port;
+
+    pthread_mutex_lock(&mutex_clilist);
+
+    QTAILQ_INSERT_TAIL(&clients, client, next);
+
+    pthread_mutex_unlock(&mutex_clilist);
+
+    INFO("Added new sdb client. ip: %s, port: %d\n", client->addr, client->port);
+
+    send_to_client(client, is_suspended_state());
+}
+
 static int parse_val(char* buff, unsigned char data, char* parsbuf)
 {
     int count = 0;