Skip to content

Commit

Permalink
Connecting UDP proxy socket on the first received message.
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed May 25, 2024
1 parent ca02afd commit f31190a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugin/udp_socket/proxy/UdpProxySocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ void UdpProxySocket::readFromListenSocket()
continue;
}

if (m_listenSocket->state() != QUdpSocket::ConnectedState) {
m_listenSocket->connectToHost(senderAddress, senderPort);
if (!m_listenSocket->waitForConnected(100)) {
std::cerr << "WARNING: cannot connect to the initiating UDP socket." << std::endl;
}
}

QString from =
senderAddress.toString() + ':' +
Expand All @@ -278,7 +284,6 @@ void UdpProxySocket::readFromListenSocket()
QString("%1").arg(m_remoteSocket->peerPort());
}


dataPtr->m_extraProperties.insert(udpFromProp(), from);
dataPtr->m_extraProperties.insert(udpToProp(), to);
reportDataReceived(std::move(dataPtr));
Expand Down

0 comments on commit f31190a

Please sign in to comment.