Avoid fragmentation of pskreporter destined datagrams

Keep  datagram size  below  a  reasonable IPv4  MTU  size of  protocol
headers + 1400.

Thanks to Philip,  N1DQ, for the suggestion as with  FT8 mode datagram
payload sizes to Pskrepotrer are sometimes as big a 8kBytes.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8339 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-12-17 22:44:13 +00:00
parent 293682d62b
commit 28c9bde5a5

View File

@ -12,6 +12,11 @@
#include "moc_psk_reporter.cpp"
namespace
{
int constexpr MAX_PAYLOAD_LENGTH {1400};
}
PSK_Reporter::PSK_Reporter(MessageClient * message_client, QObject *parent) :
QObject {parent},
m_messageClient {message_client},
@ -68,10 +73,7 @@ void PSK_Reporter::addRemoteStation(QString call, QString grid, QString freq, QS
void PSK_Reporter::sendReport()
{
if (m_spotQueue.isEmpty()) {
return;
}
while (!m_spotQueue.isEmpty()) {
QString report_h;
// Header
@ -91,7 +93,8 @@ void PSK_Reporter::sendReport()
// Sender information
QString txInfoData_h = "50E3llll";
while (!m_spotQueue.isEmpty()) {
while (!m_spotQueue.isEmpty()
&& header_h.size () + m_rxInfoDescriptor_h.size () + m_txInfoDescriptor_h.size () + rxInfoData_h.size () + txInfoData_h.size () < MAX_PAYLOAD_LENGTH) {
QHash<QString,QString> spot = m_spotQueue.dequeue();
txInfoData_h += QString("%1").arg(spot["call"].length(),2,16,QChar('0')) + spot["call"].toUtf8().toHex();
txInfoData_h += QString("%1").arg(spot["freq"].toLongLong(),8,16,QChar('0'));
@ -114,6 +117,7 @@ void PSK_Reporter::sendReport()
m_messageClient->send_raw_datagram (report, m_pskReporterAddress, 4739);
}
}
}
void PSK_Reporter::dnsLookupResult(QHostInfo info)
{