The proxy should be checked if the port has been disconnected.
So, if the reply sent to the stub is null, should call the 'disconnected
callback' except 'G_IO_ERROR_CANCELLED'
Change-Id: Icdd80baad7cae62b5ba7886ff790435380fd4e65
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
res, &err);
if (reply == nullptr) {
LOGE("No reply. err(%s)", err ? err->message : "Unknown");
- g_error_free(err);
- return;
+ if (err && err->code == G_IO_ERROR_CANCELLED) {
+ g_error_free(err);
+ return;
+ }
}
FdBroker* broker = static_cast<FdBroker*>(user_data);
IEventWatcher* watcher = broker->watcher_;
+ if (err) {
+ watcher->OnPortDisconnected(broker->watch_appid_, broker->watch_port_name_,
+ true);
+ g_error_free(err);
+ return;
+ }
+
GVariant* reply_body = g_dbus_message_get_body(reply);
if (reply_body == nullptr) {
LOGE("g_dbus_message_get_body() is failed");
virtual void OnPortConnected(const std::string& appid,
const std::string& port_name) = 0;
virtual void OnPortDisconnected(const std::string& appid,
- const std::string& port_name) = 0;
+ const std::string& port_name,
+ bool cancel = false) = 0;
};
explicit FdBroker(bool mock = false) : mock_(mock) {}
}
void Proxy::OnPortDisconnected(const std::string& appid,
- const std::string& port_name) {
+ const std::string& port_name, bool cancel) {
LOGW("[__OnPortDisconnected__] endporint(%s), port_name(%s)",
appid.c_str(), port_name.c_str());
+ if (cancel) {
+ close(fds_[0]);
+ close(fds_[1]);
+ }
+
IEventListener* listener = listener_;
listener_ = nullptr;
listener->OnDisconnected(appid);
void OnPortConnected(const std::string& appid,
const std::string& port_name) override;
void OnPortDisconnected(const std::string& appid,
- const std::string& port_name) override;
+ const std::string& port_name,
+ bool cancel = false) override;
private:
std::string port_name_;