Commit af828836 authored by Don Gagne's avatar Don Gagne

Merge pull request #1620 from dogmaphobic/udpFix

Move the socket close to the proper thread.
parents 2306566c 66c712e4
...@@ -107,6 +107,9 @@ void UDPLink::run() ...@@ -107,6 +107,9 @@ void UDPLink::run()
{ {
_hardwareConnect(); _hardwareConnect();
exec(); exec();
if (_socket) {
_socket->close();
}
} }
void UDPLink::_restartConnection() void UDPLink::_restartConnection()
...@@ -225,7 +228,6 @@ bool UDPLink::_disconnect(void) ...@@ -225,7 +228,6 @@ bool UDPLink::_disconnect(void)
this->wait(); this->wait();
if (_socket) { if (_socket) {
// Make sure delete happen on correct thread // Make sure delete happen on correct thread
_socket->close();
_socket->deleteLater(); _socket->deleteLater();
_socket = NULL; _socket = NULL;
emit disconnected(); emit disconnected();
...@@ -249,12 +251,17 @@ bool UDPLink::_connect(void) ...@@ -249,12 +251,17 @@ bool UDPLink::_connect(void)
} }
// TODO When would this ever return false? // TODO When would this ever return false?
bool connected = true; bool connected = true;
start(HighPriority); // I see no reason to run this in "HighPriority"
start(NormalPriority);
return connected; return connected;
} }
bool UDPLink::_hardwareConnect() bool UDPLink::_hardwareConnect()
{ {
if (_socket) {
delete _socket;
_socket = NULL;
}
QHostAddress host = QHostAddress::Any; QHostAddress host = QHostAddress::Any;
_socket = new QUdpSocket(); _socket = new QUdpSocket();
_socket->setProxy(QNetworkProxy::NoProxy); _socket->setProxy(QNetworkProxy::NoProxy);
......
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