Unverified Commit 6f83bfc1 authored by Morton Lin's avatar Morton Lin Committed by GitHub

fix issue of 'Error writing to QHostAddress("")' (#9144)

* fix issue of 'Error writing to QHostAddress("")'

(cherry picked from commit 9450b97c94af8c4919151ae91e9c7601b74e95ad)

* remove obsolete comments

(cherry picked from commit 7ff3b0049b9f91f39f5e764c92058ba1c0484308)

* add comment on why the additional condition check is required.

(cherry picked from commit 149e19b7c90f178f8a7e8a544243ce7acd642fe8)
parent 7e2a2f65
...@@ -181,8 +181,12 @@ void UDPLink::readBytes() ...@@ -181,8 +181,12 @@ void UDPLink::readBytes()
datagram.resize(_socket->pendingDatagramSize()); datagram.resize(_socket->pendingDatagramSize());
QHostAddress sender; QHostAddress sender;
quint16 senderPort; quint16 senderPort;
//-- Note: This call is broken in Qt 5.9.3 on Windows. It always returns a blank sender and 0 for the port. // If the other end is reset then it will still report data available,
_socket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort); // but will fail on the readDatagram call
qint64 slen = _socket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
if (slen == -1) {
databuffer.append(datagram); databuffer.append(datagram);
//-- Wait a bit before sending it over //-- Wait a bit before sending it over
if (databuffer.size() > 10 * 1024) { if (databuffer.size() > 10 * 1024) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment