Fix issue request sending fail log is displayed before connection is established 60/228660/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 24 Mar 2020 11:28:57 +0000 (20:28 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 24 Mar 2020 11:31:35 +0000 (20:31 +0900)
Change-Id: I655ef74f51c62c82a4c476b9b2fabb2faee774f3
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
receiver/src/ft.cpp

index 4a2ec79..cc821a9 100644 (file)
@@ -273,7 +273,18 @@ void accept_file()
 
 void request_sticker_data(const char *mode, const char *category, const char *type)
 {
-    JsonObject *j_object = json_object_new();
+    JsonObject *j_object = NULL;
+    if (!priv_data.socket) {
+        pending_request.req_type = REQUEST_TYPE_SYNC;
+        pending_request.mode = string(mode ? mode : "manual");
+        pending_request.category = string(category? category : "arsticker");
+        pending_request.type = string(type ? type : "input");
+
+        LOGI("Push sync request");
+        return;
+    }
+
+    j_object = json_object_new();
     if (j_object == NULL) {
         LOGE("json object create error");
         return;
@@ -286,12 +297,7 @@ void request_sticker_data(const char *mode, const char *category, const char *ty
     json_object_set_string_member(j_object, "type", type);
 
     if (_send_json_data(j_object) == FALSE) {
-        pending_request.req_type = REQUEST_TYPE_SYNC;
-        pending_request.mode = string(mode ? mode : "manual");
-        pending_request.category = string(category? category : "arsticker");
-        pending_request.type = string(type ? type : "input");
-
-        LOGI("Push sync request");
+        LOGE("Failed to send STICKER_SYNC_START_REQ");
     }
     else {
         current_request.req_type = REQUEST_TYPE_SYNC;
@@ -305,7 +311,15 @@ void request_sticker_data(const char *mode, const char *category, const char *ty
 
 void request_sticker_feature()
 {
-    JsonObject *j_object = json_object_new();
+    JsonObject *j_object = NULL;
+
+    if (!priv_data.socket) {
+        pending_request.req_type = REQUEST_TYPE_FEATURE_REQ;
+        LOGI("Push sync feature request");
+        return;
+    }
+
+    j_object = json_object_new();
     if (j_object == NULL) {
         LOGE("json object create error");
         return;
@@ -315,7 +329,6 @@ void request_sticker_feature()
     json_object_set_int_member(j_object, "tID", ++t_id);
 
     if (_send_json_data(j_object) == FALSE) {
-        pending_request.req_type = REQUEST_TYPE_FEATURE_REQ;
         LOGE("Failed to send STICKER_SYNC_FEATURE_REQ");
     }