kopia lustrzana https://gitlab.com/eliggett/wfview
Various tidying in server and client code
rodzic
93e2c5529e
commit
8ec82e7406
|
@ -4,6 +4,19 @@
|
|||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
// Various settings used by both client and server
|
||||
#define PURGE_SECONDS 10
|
||||
#define TOKEN_RENEWAL 60000
|
||||
#define PING_PERIOD 500
|
||||
#define IDLE_PERIOD 100
|
||||
#define TXAUDIO_PERIOD 10
|
||||
#define AREYOUTHERE_PERIOD 500
|
||||
#define WATCHDOG_PERIOD 500
|
||||
#define RETRANSMIT_PERIOD 100 // How often to attempt retransmit
|
||||
#define LOCK_PERIOD 10 // How long to try to lock mutex (ms)
|
||||
#define STALE_CONNECTION 15 // Not heard from in this many seconds
|
||||
|
||||
|
||||
// Fixed Size Packets
|
||||
#define CONTROL_SIZE 0x10
|
||||
#define WATCHDOG_SIZE 0x14
|
||||
|
|
|
@ -24,15 +24,6 @@
|
|||
#include "audiohandler.h"
|
||||
#include "packettypes.h"
|
||||
|
||||
#define PURGE_SECONDS 10
|
||||
#define TOKEN_RENEWAL 60000
|
||||
#define PING_PERIOD 100
|
||||
#define IDLE_PERIOD 100
|
||||
#define TXAUDIO_PERIOD 10
|
||||
#define AREYOUTHERE_PERIOD 500
|
||||
#define WATCHDOG_PERIOD 500
|
||||
#define RETRANSMIT_PERIOD 100
|
||||
#define LOCK_PERIOD 100
|
||||
|
||||
struct udpPreferences {
|
||||
QString ipAddress;
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#include "udpserver.h"
|
||||
#include "logcategories.h"
|
||||
|
||||
#define STALE_CONNECTION 15
|
||||
#define LOCK_PERIOD 10 // time to attempt to lock Mutex in ms
|
||||
udpServer::udpServer(SERVERCONFIG config, audioSetup outAudio, audioSetup inAudio) :
|
||||
config(config),
|
||||
outAudio(outAudio),
|
||||
|
@ -96,6 +94,21 @@ udpServer::~udpServer()
|
|||
udpAudio->close();
|
||||
delete udpAudio;
|
||||
}
|
||||
|
||||
if (rxAudioThread != Q_NULLPTR) {
|
||||
rxAudioThread->quit();
|
||||
rxAudioThread->wait();
|
||||
rxaudio = Q_NULLPTR;
|
||||
rxAudioThread = Q_NULLPTR;
|
||||
}
|
||||
|
||||
if (txAudioThread != Q_NULLPTR) {
|
||||
txAudioThread->quit();
|
||||
txAudioThread->wait();
|
||||
txaudio = Q_NULLPTR;
|
||||
txAudioThread = Q_NULLPTR;
|
||||
}
|
||||
|
||||
emit haveNetworkStatus(QString(""));
|
||||
|
||||
}
|
||||
|
@ -106,8 +119,6 @@ void udpServer::receiveRigCaps(rigCapabilities caps)
|
|||
this->rigCaps = caps;
|
||||
}
|
||||
|
||||
#define RETRANSMIT_PERIOD 100
|
||||
|
||||
void udpServer::controlReceived()
|
||||
{
|
||||
// Received data on control port.
|
||||
|
@ -596,7 +607,7 @@ void udpServer::audioReceived()
|
|||
|
||||
current->pingTimer = new QTimer();
|
||||
connect(current->pingTimer, &QTimer::timeout, this, std::bind(&udpServer::sendPing, this, &audioClients, current, (quint16)0x00, false));
|
||||
current->pingTimer->start(100);
|
||||
current->pingTimer->start(PING_PERIOD);
|
||||
|
||||
current->retransmitTimer = new QTimer();
|
||||
connect(current->retransmitTimer, &QTimer::timeout, this, std::bind(&udpServer::sendRetransmitRequest, this, current));
|
||||
|
@ -630,15 +641,9 @@ void udpServer::audioReceived()
|
|||
sendPing(&audioClients, current, in->seq, true);
|
||||
}
|
||||
else if (in->reply == 0x01) {
|
||||
if (in->seq == current->pingSeq || in->seq == current->pingSeq - 1)
|
||||
if (in->seq == current->pingSeq)
|
||||
{
|
||||
// A Reply to our ping!
|
||||
if (in->seq == current->pingSeq) {
|
||||
current->pingSeq++;
|
||||
}
|
||||
else {
|
||||
qInfo(logUdpServer()) << current->ipAddress.toString() << ": got out of sequence ping reply. Got: " << in->seq << " expecting: " << current->pingSeq;
|
||||
}
|
||||
current->pingSeq++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1292,8 +1297,6 @@ void udpServer::sendTokenResponse(CLIENT* c, quint8 type)
|
|||
return;
|
||||
}
|
||||
|
||||
#define PURGE_SECONDS 60
|
||||
|
||||
void udpServer::watchdog()
|
||||
{
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
|
|
Ładowanie…
Reference in New Issue