mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-25 20:07:51 +02:00
added new patrons
This commit is contained in:
@ -56,6 +56,9 @@ private:
|
||||
|
||||
static void start(void* ctx) {
|
||||
RTLTCPSourceModule* _this = (RTLTCPSourceModule*)ctx;
|
||||
if (_this->running) {
|
||||
return;
|
||||
}
|
||||
if (!_this->client.connectToRTL(_this->ip, _this->port)) {
|
||||
spdlog::error("Could not connect to {0}:{1}", _this->ip, _this->port);
|
||||
return;
|
||||
@ -73,6 +76,9 @@ private:
|
||||
|
||||
static void stop(void* ctx) {
|
||||
RTLTCPSourceModule* _this = (RTLTCPSourceModule*)ctx;
|
||||
if (!_this->running) {
|
||||
return;
|
||||
}
|
||||
_this->running = false;
|
||||
_this->stream.stopWriter();
|
||||
_this->workerThread.join();
|
||||
|
@ -24,6 +24,10 @@ public:
|
||||
}
|
||||
|
||||
bool connectToRTL(char* host, uint16_t port) {
|
||||
if (connected) {
|
||||
return true;
|
||||
}
|
||||
|
||||
struct addrinfo *result = NULL;
|
||||
struct addrinfo *ptr = NULL;
|
||||
struct addrinfo hints;
|
||||
@ -62,12 +66,18 @@ public:
|
||||
}
|
||||
freeaddrinfo(result);
|
||||
|
||||
connected = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void disconnect() {
|
||||
if (!connected) {
|
||||
return;
|
||||
}
|
||||
closesocket(sock);
|
||||
WSACleanup();
|
||||
connected = false;
|
||||
}
|
||||
|
||||
// struct command_t {
|
||||
@ -116,5 +126,6 @@ public:
|
||||
|
||||
private:
|
||||
SOCKET sock;
|
||||
bool connected = false;
|
||||
|
||||
};
|
Reference in New Issue
Block a user