#define LOG_TAG "RPC_PORT"
+#define EILLEGALACCESS 127
#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
#define DBUS_PATH_DBUS "/org/freedesktop/DBus"
int FdBroker::DBusMock::Send(const std::string& sender,
const std::string& port, int fds[2]) {
+ if (port == "wrong_port")
+ return -EILLEGALACCESS;
if (ports_.find(port) == ports_.end())
return -1;
LOGE("Access Denied[sender_appid : %s]", sender_appid);
g_object_unref(msg);
g_object_unref(reply);
- return -1;
+ return -EILLEGALACCESS;
}
LOGD("[Reply : %d]", ret);
int fds[2] = { 0, };
int r = fd_broker_.Send(appid, port_name, &fds);
- if (r <= 0 || fds[0] <= 0 || fds[1] <= 0) {
+ if (r <= 0) {
IEventListener* listener = listener_;
listener_ = nullptr;
- listener->OnRejected(appid);
+ if (r == -EILLEGALACCESS)
+ listener->OnRejected(appid);
+ else
+ listener->OnDisconnected(appid);
return;
}
void Proxy::OnPortVanished(const std::string& appid,
const std::string& port_name) {
- LOGD("endpoint(%s), port_name(%s)", appid.c_str(), port_name.c_str());
+ LOGW("[__OnPortVanished__] endpoint(%s), port_name(%s)",
+ appid.c_str(), port_name.c_str());
}
int Proxy::Connect(const std::string appid, const std::string& port_name,