Cancel the request when timeout happen 43/219443/1
authorJunghoon Park <jh9216.park@samsung.com>
Thu, 5 Dec 2019 02:09:45 +0000 (11:09 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Thu, 5 Dec 2019 02:09:45 +0000 (11:09 +0900)
Change-Id: Idcb9612efce312537454b007e33fa486fa442271
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
src/fdbroker-internal.cc
src/proxy-internal.cc

index 5d8db42..376c2c7 100644 (file)
@@ -774,6 +774,12 @@ void FdBroker::OnResultReceived(GObject* source_object,
     watcher->OnPortDisconnected(broker->watch_appid_, broker->watch_port_name_,
         true);
     g_error_free(err);
+    if (broker && broker->cancellable_) {
+      LOGW("Cancel the send request");
+      g_cancellable_cancel(broker->cancellable_);
+      g_object_unref(broker->cancellable_);
+      broker->cancellable_ = nullptr;
+    }
     return;
   }
 
index 1b183fb..7d78f8d 100644 (file)
@@ -82,7 +82,8 @@ gboolean Proxy::OnDataReceived(GIOChannel *gio, GIOCondition cond,
       return FALSE;
     }
 
-    proxy->listener_->OnReceived(proxy->target_appid_);
+    if (proxy->listener_)
+      proxy->listener_->OnReceived(proxy->target_appid_);
   }
 
   return TRUE;
@@ -134,6 +135,10 @@ void Proxy::OnPortConnected(const std::string& appid,
                             const std::string& port_name) {
   LOGW("[__OnPortConnected__] endpoint(%s), port_name(%s)",
       appid.c_str(), port_name.c_str());
+  if (!listener_) {
+    LOGW("listener is null");
+    return;
+  }
 
   main_port_.reset(new ProxyPort(this, fds_[0], appid, false));
   delegate_port_.reset(new ProxyPort(this, fds_[1], appid));
@@ -150,6 +155,11 @@ void Proxy::OnPortDisconnected(const std::string& appid,
     close(fds_[1]);
   }
 
+  if (!listener_) {
+    LOGW("listener is null");
+    return;
+  }
+
   IEventListener* listener = listener_;
   listener_ = nullptr;
   listener->OnDisconnected(appid);