| 666 | } |
| 667 | |
| 668 | sd_bus_message* Connection::callMethod(sd_bus_message* sdbusMsg, uint64_t timeout) |
| 669 | { |
| 670 | sd_bus_error sdbusError = SD_BUS_ERROR_NULL; |
| 671 | SCOPE_EXIT{ sd_bus_error_free(&sdbusError); }; |
| 672 | |
| 673 | // This call will block the bus connection from serving other messages |
| 674 | // until the reply arrives or the call times out. |
| 675 | sd_bus_message* sdbusReply{}; |
| 676 | auto r = sdbus_->sd_bus_call(nullptr, sdbusMsg, timeout, &sdbusError, &sdbusReply); |
| 677 | |
| 678 | if (sd_bus_error_is_set(&sdbusError) != 0) |
| 679 | throw Error(Error::Name{sdbusError.name}, sdbusError.message); |
| 680 | |
| 681 | SDBUS_THROW_ERROR_IF(r < 0, "Failed to call method", -r); |
| 682 | |
| 683 | // Wake up event loop to process messages that may have arrived in the meantime, |
| 684 | // or to dispatch the outbound message that hasn't yet been fully sent out. |
| 685 | wakeUpEventLoopIfMessagesInQueue(); |
| 686 | |
| 687 | return sdbusReply; |
| 688 | } |
| 689 | |
| 690 | Slot Connection::callMethodAsync(sd_bus_message* sdbusMsg, sd_bus_message_handler_t callback, void* userData, uint64_t timeout, return_slot_t) |
| 691 | { |
nothing calls this directly
no test coverage detected