Skip to content

Commit

Permalink
Manual pairing fix
Browse files Browse the repository at this point in the history
  • Loading branch information
XITRIX committed Dec 5, 2024
1 parent bbed9f9 commit 4595b61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
8 changes: 4 additions & 4 deletions app/src/add_host_tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ void AddHostTab::connectHost(const std::string& address) {
loaderView->open();

GameStreamClient::instance().connect(
address, [this, loaderView](const GSResult<SERVER_DATA>& result) {
loaderView->close([this, result] {
address, [this, loaderView, address](const GSResult<SERVER_DATA>& result) {
loaderView->close([this, result, address] {
if (result.isSuccess()) {
Host host{.address = result.value().address,
Host host{.address = address,
.hostname = result.value().hostname,
.mac = result.value().mac};

Expand All @@ -167,7 +167,7 @@ void AddHostTab::connectHost(const std::string& address) {

ASYNC_RETAIN
GameStreamClient::instance().pair(
result.value().address, pin,
address, pin,
[ASYNC_TOKEN, host, dialog](const GSResult<bool>& result) {
ASYNC_RELEASE
dialog->dismiss([result, host] {
Expand Down
15 changes: 5 additions & 10 deletions app/src/streaming/GameStreamClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,14 @@ void GameStreamClient::wake_up_host(const Host& host,

void GameStreamClient::connect(const std::string& address,
ServerCallback<SERVER_DATA>& callback) {
m_server_data[address] = SERVER_DATA();

brls::async([this, address, callback] {
int status = gs_init(&m_server_data[address], address);
SERVER_DATA server_data;
int status = gs_init(&server_data, address);

brls::sync([this, address, callback, status] {
brls::sync([this, address, callback, status, server_data] {
if (status == GS_OK) {
Host host;
host.address = address;
host.hostname = m_server_data[address].hostname;
host.mac = m_server_data[address].mac;
callback(
GSResult<SERVER_DATA>::success(m_server_data[address]));
m_server_data[address] = server_data;
callback(GSResult<SERVER_DATA>::success(server_data));
} else {
callback(GSResult<SERVER_DATA>::failure(gs_error()));
}
Expand Down

0 comments on commit 4595b61

Please sign in to comment.