diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-03 22:23:08 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-04 12:19:26 +0100 |
commit | b256886a5cb9f2ae3ebda70a2045b19ed9f4233e (patch) | |
tree | 4fa1e46de224cf834a05824dc1eb86001bdb3300 /tracker-udp/ftnoir_tracker_udp.cpp | |
parent | e89709a801e7874bc02c66848c638c6a0ccc85c1 (diff) |
api: add status check for modules
Diffstat (limited to 'tracker-udp/ftnoir_tracker_udp.cpp')
-rw-r--r-- | tracker-udp/ftnoir_tracker_udp.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tracker-udp/ftnoir_tracker_udp.cpp b/tracker-udp/ftnoir_tracker_udp.cpp index b3df5e60..41aa96c2 100644 --- a/tracker-udp/ftnoir_tracker_udp.cpp +++ b/tracker-udp/ftnoir_tracker_udp.cpp @@ -29,9 +29,6 @@ void udp::run() QByteArray datagram; datagram.resize(sizeof(last_recv_pose)); - if (!sock.bind(QHostAddress::Any, quint16(s.port), QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) - return; - while (!isInterruptionRequested()) { if (sock.hasPendingDatagrams()) @@ -69,10 +66,15 @@ void udp::run() } } -void udp::start_tracker(QFrame*) +module_status udp::start_tracker(QFrame*) { - start(); + if (!sock.bind(QHostAddress::Any, quint16(s.port), QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint)) + return error(tr("Can't bind socket -- %1").arg(sock.errorString())); + sock.moveToThread(this); + start(); + + return status_ok(); } void udp::data(double *data) |