Browse Source

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)
QGC4.4
Morton Lin 5 years ago committed by GitHub
parent
commit
6f83bfc10e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/comm/UDPLink.cc

8
src/comm/UDPLink.cc

@ -181,8 +181,12 @@ void UDPLink::readBytes() @@ -181,8 +181,12 @@ void UDPLink::readBytes()
datagram.resize(_socket->pendingDatagramSize());
QHostAddress sender;
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.
_socket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
// If the other end is reset then it will still report data available,
// but will fail on the readDatagram call
qint64 slen = _socket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
if (slen == -1) {
break;
}
databuffer.append(datagram);
//-- Wait a bit before sending it over
if (databuffer.size() > 10 * 1024) {

Loading…
Cancel
Save