mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-11-10 04:37:37 +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
|
||||
int res = getUI();
|
||||
if (res == -1) { throw std::runtime_error("Timed out"); }
|
||||
else if (res == -2) { throw std::runtime_error("Server busy"); }
|
||||
if (res < 0) {
|
||||
// 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() {
|
||||
@ -234,7 +246,7 @@ namespace server {
|
||||
else {
|
||||
if (!serverBusy) { flog::error("Timeout out after asking for UI"); };
|
||||
waiter->handled();
|
||||
return serverBusy ? -2 : -1;
|
||||
return serverBusy ? CONN_ERR_BUSY : CONN_ERR_TIMEOUT;
|
||||
}
|
||||
waiter->handled();
|
||||
return 0;
|
||||
|
@ -71,6 +71,11 @@ namespace server {
|
||||
std::mutex handledMtx;
|
||||
};
|
||||
|
||||
enum ConnectionError {
|
||||
CONN_ERR_TIMEOUT = -1,
|
||||
CONN_ERR_BUSY = -2
|
||||
};
|
||||
|
||||
class Client {
|
||||
public:
|
||||
Client(std::shared_ptr<net::Socket> sock, dsp::stream<dsp::complex_t>* out);
|
||||
|
Loading…
Reference in New Issue
Block a user