Set error cause of rejected event 02/228802/1
authorJusung Son <jusung07.son@samsung.com>
Thu, 26 Mar 2020 00:11:24 +0000 (09:11 +0900)
committerJusung Son <jusung07.son@samsung.com>
Thu, 26 Mar 2020 00:11:24 +0000 (09:11 +0900)
Change-Id: I270ab5aca49e5302f5f74abc6b462150db0dadb0
Signed-off-by: Jusung Son <jusung07.son@samsung.com>
src/proxy-internal.cc
src/proxy-internal.h
src/rpc-port.cc

index 2f8a5d7..a97565a 100644 (file)
@@ -95,7 +95,7 @@ void Proxy::OnPortRejected(const std::string& appid) {
 
   IEventListener* listener = listener_;
   listener_ = nullptr;
-  listener->OnRejected(appid);
+  listener->OnRejected(appid, RPC_PORT_ERROR_PERMISSION_DENIED);
 }
 
 void Proxy::OnPortAppeared(const std::string& appid,
@@ -116,7 +116,7 @@ void Proxy::OnPortAppeared(const std::string& appid,
     IEventListener* listener = listener_;
     listener_ = nullptr;
     if (r == -EILLEGALACCESS)
-      listener->OnRejected(appid);
+      listener->OnRejected(appid, RPC_PORT_ERROR_PERMISSION_DENIED);
     else
       listener->OnDisconnected(appid);
     return;
@@ -244,7 +244,7 @@ gboolean Proxy::DbusNameTimeout(gpointer user_data) {
     IEventListener* listener = obj->listener_;
     obj->listener_ = nullptr;
     obj->fd_broker_.Cancel();
-    listener->OnRejected(obj->target_appid_);
+    listener->OnRejected(obj->target_appid_, RPC_PORT_ERROR_IO_ERROR);
   }
 
   return G_SOURCE_REMOVE;
index a5046b0..61c1318 100644 (file)
@@ -39,7 +39,7 @@ class Proxy : public FdBroker::IEventWatcher {
    public:
     virtual void OnConnected(const std::string& endpoint, Port* port) = 0;
     virtual void OnDisconnected(const std::string& endpoint) = 0;
-    virtual void OnRejected(const std::string& endpoint) = 0;
+    virtual void OnRejected(const std::string& endpoint, int err_code) = 0;
     virtual void OnReceived(const std::string& endpoint) = 0;
   };
 
index 97125c5..2a36d25 100644 (file)
@@ -82,8 +82,9 @@ class ProxyExt : public Proxy, public Proxy::IEventListener {
     }
   }
 
-  void OnRejected(const std::string& endpoint) override {
+  void OnRejected(const std::string& endpoint, int err_code) override {
     for (auto& ev : rejected_events_) {
+      set_last_result(err_code);
       ev->cb_(endpoint.c_str(), GetPortName().c_str(), ev->user_data_);
     }
   }