return RPC_PORT_ERROR_IO_ERROR;
}
+ if (gettid() == getpid()) {
+ if (handle->callback.connected)
+ handle->callback.connected(context, sender, instance, sync);
+
+ return RPC_PORT_ERROR_NONE;
+ }
+
data = rpc_port_stub_lem_data_create(context, sender, instance, sync);
if (data == nullptr) {
_E("Ouf of memory");
g_source_set_callback(source, (GSourceFunc)rpc_port_stub_lem_on_connected, handle, nullptr);
g_source_attach(source, handle->context);
g_source_unref(source);
-
return RPC_PORT_ERROR_NONE;
}
return RPC_PORT_ERROR_IO_ERROR;
}
+ if (gettid() == getpid()) {
+ if (handle->callback.disconnected)
+ handle->callback.disconnected(context, sender, instance);
+
+ return RPC_PORT_ERROR_NONE;
+ }
+
data = rpc_port_stub_lem_data_create(context, sender, instance, false);
if (data == nullptr) {
_E("Ouf of memory");
return RPC_PORT_ERROR_IO_ERROR;
}
+ if (gettid() == getpid()) {
+ if (handle->callback.received)
+ handle->callback.received(context, sender, instance, parcel);
+
+ return RPC_PORT_ERROR_NONE;
+ }
+
data = rpc_port_stub_lem_data_create_with_parcel(context, sender, instance, parcel);
if (data == nullptr) {
_E("Ouf of memory");
std::string sender_str(sender);
std::string instance_str(instance);
+ if (gettid() == getpid()) {
+ <CLS_NAME>_context_->OnConnected(context, sender, instance, sync);
+ return RPC_PORT_ERROR_NONE;
+ }
+
auto* func = new std::function<void()>([context, sender_str, instance_str, sync] {
<CLS_NAME>_context_->OnConnected(context, sender_str, instance_str, sync);
});
std::string sender_str(sender);
std::string instance_str(instance);
+ if (gettid() == getpid()) {
+ <CLS_NAME>_context_->OnDisconnected(context, sender, instance);
+ return RPC_PORT_ERROR_NONE;
+ }
+
auto* func = new std::function<void()>([context, sender_str, instance_str] {
<CLS_NAME>_context_->OnDisconnected(context, sender_str, instance_str);
});
}
rpc_port_parcel_h cloned_parcel = Clone(parcel);
+ if (gettid() == getpid()) {
+ <CLS_NAME>_context_->OnReceived(context, cloned_parcel);
+ return RPC_PORT_ERROR_NONE;
+ }
+
auto* func = new std::function<void()>([context, cloned_parcel] {
<CLS_NAME>_context_->OnReceived(context, cloned_parcel);
});