mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-11-12 21:42:51 +01:00
potential fix for #677
This commit is contained in:
parent
e1c48e9a1f
commit
07eebd7018
@ -42,8 +42,20 @@ namespace server {
|
|||||||
|
|
||||||
// Ask for a UI
|
// Ask for a UI
|
||||||
int res = getUI();
|
int res = getUI();
|
||||||
if (res == -1) { throw std::runtime_error("Timed out"); }
|
if (res < 0) {
|
||||||
else if (res == -2) { throw std::runtime_error("Server busy"); }
|
// Close client
|
||||||
|
close();
|
||||||
|
|
||||||
|
// Throw error
|
||||||
|
switch (res) {
|
||||||
|
case CONN_ERR_TIMEOUT:
|
||||||
|
throw std::runtime_error("Timed out");
|
||||||
|
case CONN_ERR_BUSY:
|
||||||
|
throw std::runtime_error("Server busy");
|
||||||
|
default:
|
||||||
|
throw std::runtime_error("Unknown error");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Client::~Client() {
|
Client::~Client() {
|
||||||
@ -234,7 +246,7 @@ namespace server {
|
|||||||
else {
|
else {
|
||||||
if (!serverBusy) { flog::error("Timeout out after asking for UI"); };
|
if (!serverBusy) { flog::error("Timeout out after asking for UI"); };
|
||||||
waiter->handled();
|
waiter->handled();
|
||||||
return serverBusy ? -2 : -1;
|
return serverBusy ? CONN_ERR_BUSY : CONN_ERR_TIMEOUT;
|
||||||
}
|
}
|
||||||
waiter->handled();
|
waiter->handled();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -71,6 +71,11 @@ namespace server {
|
|||||||
std::mutex handledMtx;
|
std::mutex handledMtx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ConnectionError {
|
||||||
|
CONN_ERR_TIMEOUT = -1,
|
||||||
|
CONN_ERR_BUSY = -2
|
||||||
|
};
|
||||||
|
|
||||||
class Client {
|
class Client {
|
||||||
public:
|
public:
|
||||||
Client(std::shared_ptr<net::Socket> sock, dsp::stream<dsp::complex_t>* out);
|
Client(std::shared_ptr<net::Socket> sock, dsp::stream<dsp::complex_t>* out);
|
||||||
|
Loading…
Reference in New Issue
Block a user