[Edge] handle connection failure case
authorJaeyun <jy1210.jung@samsung.com>
Thu, 28 Jul 2022 03:48:09 +0000 (12:48 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Thu, 28 Jul 2022 09:35:16 +0000 (18:35 +0900)
Handle connection closed case, connection info in hashtable is null.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
src/libnnstreamer-edge/nnstreamer-edge-internal.c

index 4d6e85cc791dfb3e05ace7fafa35c2ddf49d9ae4..cd6877c23606cff09f0a2a452153693bfce87895 100644 (file)
@@ -1261,7 +1261,7 @@ nns_edge_request (nns_edge_h edge_h, nns_edge_data_h data_h)
   }
 
   conn_data = _nns_edge_get_connection (eh, eh->client_id);
-  if (!_nns_edge_check_connection (conn_data->sink_conn)) {
+  if (!conn_data || !_nns_edge_check_connection (conn_data->sink_conn)) {
     nns_edge_loge ("Failed to request, connection failure.");
     nns_edge_unlock (eh);
     return NNS_EDGE_ERROR_CONNECTION_FAILURE;
@@ -1529,7 +1529,8 @@ nns_edge_respond (nns_edge_h edge_h, nns_edge_data_h data_h)
 
   conn_data = _nns_edge_get_connection (eh, client_id);
   if (!conn_data) {
-    nns_edge_loge ("Cannot find connection, invalid client ID.");
+    nns_edge_loge
+        ("Cannot find connection, invalid client ID or connection closed.");
     nns_edge_unlock (eh);
     return NNS_EDGE_ERROR_INVALID_PARAMETER;
   }