This commit is contained in:
David Rowe 2021-09-04 14:31:20 +12:00
parent dddabecc84
commit b5867fef48
4 changed files with 5 additions and 4 deletions

View file

@ -470,10 +470,12 @@ void NodeList::sendDomainServerCheckIn() {
QByteArray compressedSystemInfo = qCompress(systemInfo);
if (compressedSystemInfo.size() > MAX_SYSTEM_INFO_SIZE) {
// FIXME
// Highly unlikely, as not even unreasonable machines will
// overflow the max size, but prevent MTU overflow anyway.
// We could do something sophisticated like clearing specific
// values if they're too big, but we'll save that for later.
// Alternative solution would be to write system info at the end of the packet, only if there is space.
compressedSystemInfo.clear();
}

View file

@ -430,6 +430,7 @@ void WebRTCDataChannels::reset() {
}
quint16 WebRTCDataChannels::getNewDataChannelID() {
// The first data channel ID is 1.
static const int QUINT16_LIMIT = std::numeric_limits<uint16_t>::max() + 1;
_lastDataChannelID = std::max((_lastDataChannelID + 1) % QUINT16_LIMIT, 1);
#ifdef WEBRTC_DEBUG
@ -533,7 +534,7 @@ bool WebRTCDataChannels::sendDataMessage(int dataChannelID, const QByteArray& by
// Find connection.
if (!_connectionsByDataChannel.contains(dataChannelID)) {
qCWarning(networking_webrtc) << "Could not find data channel to send message on!";
qCWarning(networking_webrtc) << "Could not find WebRTC data channel to send message on!";
return false;
}

View file

@ -332,7 +332,7 @@ private:
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> _peerConnectionFactory { nullptr };
quint16 _lastDataChannelID { 0 }; // First data channel ID is 1.
quint16 _lastDataChannelID { 0 };
QHash<quint16, WDCConnection*> _connectionsByWebSocket;
QHash<quint16, WDCConnection*> _connectionsByDataChannel;

View file

@ -71,13 +71,11 @@ public:
void abort();
/// @brief Nominally gets the host port number.
/// @details
/// Included for compatibility with the QUdpSocket interface.
/// @return <code>0</code>
quint16 localPort() const { return 0; }
/// @brief Nominally gets the socket descriptor.
/// @details
/// Included for compatibility with the QUdpSocket interface.
/// @return <code>-1</code>
qintptr socketDescriptor() const { return -1; }