Major bugfix in server

This commit is contained in:
AlexandreRouma
2022-01-22 02:30:08 +01:00
parent 34fc32dcf7
commit 4c1b50a3ac
10 changed files with 104 additions and 29 deletions

View File

@@ -10,6 +10,7 @@
#include <options.h>
#include <gui/widgets/stepped_slider.h>
#include <utils/optionlist.h>
#include <gui/dialogs/dialog_box.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str())
@@ -142,6 +143,10 @@ private:
bool connected = (_this->client && _this->client->isOpen());
gui::mainWindow.playButtonLocked = !connected;
ImGui::GenericDialog("##sdrpp_srv_src_err_dialog", _this->serverBusy, GENERIC_DIALOG_BUTTONS_OK, [=](){
ImGui::Text("This server is already in use.");
});
if (connected) { style::beginDisabled(); }
if (ImGui::InputText(CONCAT("##sdrpp_srv_srv_host_", _this->name), _this->hostname, 1023)) {
config.acquire();
@@ -166,6 +171,7 @@ private:
}
catch (std::exception e) {
spdlog::error("Could not connect to SDR: {0}", e.what());
if (!strcmp(e.what(), "Server busy")) { _this->serverBusy = true; }
}
}
else if (connected && ImGui::Button("Disconnect##sdrpp_srv_source", ImVec2(menuWidth, 0))) {
@@ -238,6 +244,7 @@ private:
bool running = false;
double freq;
bool serverBusy = false;
float datarate = 0;
float frametimeCounter = 0;