diff options
author | bunnei <bunneidev@gmail.com> | 2020-10-17 06:20:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-17 06:20:01 +0200 |
commit | cb708631b6d891633ad4079d7796249c19147e3f (patch) | |
tree | 250b1712e0d426636a59ddb0000eaa7dabed5da5 | |
parent | Merge pull request #4790 from lioncash/input-common (diff) | |
parent | udp/client: Make use of designated initializers in TestCommunication() (diff) | |
download | yuzu-cb708631b6d891633ad4079d7796249c19147e3f.tar yuzu-cb708631b6d891633ad4079d7796249c19147e3f.tar.gz yuzu-cb708631b6d891633ad4079d7796249c19147e3f.tar.bz2 yuzu-cb708631b6d891633ad4079d7796249c19147e3f.tar.lz yuzu-cb708631b6d891633ad4079d7796249c19147e3f.tar.xz yuzu-cb708631b6d891633ad4079d7796249c19147e3f.tar.zst yuzu-cb708631b6d891633ad4079d7796249c19147e3f.zip |
-rw-r--r-- | src/input_common/udp/client.cpp | 13 | ||||
-rw-r--r-- | src/input_common/udp/client.h | 4 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp index bb109562c..7039d6fc3 100644 --- a/src/input_common/udp/client.cpp +++ b/src/input_common/udp/client.cpp @@ -333,15 +333,18 @@ const std::array<Common::SPSCQueue<UDPPadStatus>, 4>& Client::GetPadQueue() cons } void TestCommunication(const std::string& host, u16 port, std::size_t pad_index, u32 client_id, - std::function<void()> success_callback, - std::function<void()> failure_callback) { + const std::function<void()>& success_callback, + const std::function<void()>& failure_callback) { std::thread([=] { Common::Event success_event; - SocketCallback callback{[](Response::Version version) {}, [](Response::PortInfo info) {}, - [&](Response::PadData data) { success_event.Set(); }}; + SocketCallback callback{ + .version = [](Response::Version) {}, + .port_info = [](Response::PortInfo) {}, + .pad_data = [&](Response::PadData) { success_event.Set(); }, + }; Socket socket{host, port, pad_index, client_id, std::move(callback)}; std::thread worker_thread{SocketLoop, &socket}; - bool result = success_event.WaitFor(std::chrono::seconds(8)); + const bool result = success_event.WaitFor(std::chrono::seconds(8)); socket.Stop(); worker_thread.join(); if (result) { diff --git a/src/input_common/udp/client.h b/src/input_common/udp/client.h index 2491a03a2..747e0c0a2 100644 --- a/src/input_common/udp/client.h +++ b/src/input_common/udp/client.h @@ -150,7 +150,7 @@ private: }; void TestCommunication(const std::string& host, u16 port, std::size_t pad_index, u32 client_id, - std::function<void()> success_callback, - std::function<void()> failure_callback); + const std::function<void()>& success_callback, + const std::function<void()>& failure_callback); } // namespace InputCommon::CemuhookUDP |