| 275 | } |
| 276 | |
| 277 | int Proxy::sdbus_async_reply_handler(sd_bus_message *sdbusMessage, void *userData, sd_bus_error *retError) |
| 278 | { |
| 279 | auto* asyncCallInfo = static_cast<AsyncCallInfo*>(userData); |
| 280 | assert(asyncCallInfo != nullptr); |
| 281 | assert(asyncCallInfo->callback); |
| 282 | auto& proxy = asyncCallInfo->proxy; |
| 283 | |
| 284 | // We are removing the CallData item at the complete scope exit, after the callback has been invoked. |
| 285 | // We can't do it earlier (before callback invocation for example), because CallBack data (slot release) |
| 286 | // is the synchronization point between callback invocation and Proxy::unregister. |
| 287 | SCOPE_EXIT |
| 288 | { |
| 289 | proxy.floatingAsyncCallSlots_.erase(asyncCallInfo); |
| 290 | }; |
| 291 | |
| 292 | auto message = Message::Factory::create<MethodReply>(sdbusMessage, proxy.connection_.get()); |
| 293 | |
| 294 | auto ok = invokeHandlerAndCatchErrors([&] |
| 295 | { |
| 296 | const auto* error = sd_bus_message_get_error(sdbusMessage); |
| 297 | if (error == nullptr) |
| 298 | { |
| 299 | asyncCallInfo->callback(std::move(message), {}); |
| 300 | } |
| 301 | else |
| 302 | { |
| 303 | Error exception(Error::Name{error->name}, error->message); |
| 304 | asyncCallInfo->callback(std::move(message), std::move(exception)); |
| 305 | } |
| 306 | }, retError); |
| 307 | |
| 308 | return ok ? 0 : -1; |
| 309 | } |
| 310 | |
| 311 | int Proxy::sdbus_signal_handler(sd_bus_message *sdbusMessage, void *userData, sd_bus_error *retError) |
| 312 | { |
nothing calls this directly
no test coverage detected