Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
16cf1826
Commit
16cf1826
authored
Feb 05, 2018
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typo and use Qt's builtin vector deleteAll to clear lists.
parent
faee40e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
UDPLink.cc
src/comm/UDPLink.cc
+9
-13
No files found.
src/comm/UDPLink.cc
View file @
16cf1826
...
...
@@ -89,7 +89,7 @@ static bool is_ip_local(const QHostAddress& add)
return
false
;
}
static
bool
contains
t
_target
(
const
QList
<
UDPCLient
*>
list
,
const
QHostAddress
&
address
,
quint16
port
)
static
bool
contains_target
(
const
QList
<
UDPCLient
*>
list
,
const
QHostAddress
&
address
,
quint16
port
)
{
foreach
(
UDPCLient
*
target
,
list
)
{
if
(
target
->
address
==
address
&&
target
->
port
==
port
)
{
...
...
@@ -121,10 +121,8 @@ UDPLink::~UDPLink()
// Tell the thread to exit
_running
=
false
;
// Clear client list
while
(
_sessionTargets
.
size
())
{
delete
_sessionTargets
.
last
();
_sessionTargets
.
removeLast
();
}
qDeleteAll
(
_sessionTargets
);
_sessionTargets
.
clear
();
quit
();
// Wait for it to exit
wait
();
...
...
@@ -167,7 +165,7 @@ void UDPLink::_writeBytes(const QByteArray data)
// Send to all manually targeted systems
foreach
(
UDPCLient
*
target
,
_udpConfig
->
targetHosts
())
{
// Skip it if it's part of the session clients below
if
(
!
contains
t
_target
(
_sessionTargets
,
target
->
address
,
target
->
port
))
{
if
(
!
contains_target
(
_sessionTargets
,
target
->
address
,
target
->
port
))
{
_writeDataGram
(
data
,
target
);
}
}
...
...
@@ -218,7 +216,7 @@ void UDPLink::readBytes()
if
(
is_ip_local
(
sender
))
{
asender
=
QHostAddress
(
QString
(
"127.0.0.1"
));
}
if
(
!
contains
t
_target
(
_sessionTargets
,
asender
,
senderPort
))
{
if
(
!
contains_target
(
_sessionTargets
,
asender
,
senderPort
))
{
qDebug
()
<<
"Adding target"
<<
asender
<<
senderPort
;
UDPCLient
*
target
=
new
UDPCLient
(
asender
,
senderPort
);
_sessionTargets
.
append
(
target
);
...
...
@@ -391,7 +389,7 @@ void UDPConfiguration::_copyFrom(LinkConfiguration *source)
_localPort
=
usource
->
localPort
();
_clearTargetHosts
();
foreach
(
UDPCLient
*
target
,
usource
->
targetHosts
())
{
if
(
!
contains
t
_target
(
_targetHosts
,
target
->
address
,
target
->
port
))
{
if
(
!
contains_target
(
_targetHosts
,
target
->
address
,
target
->
port
))
{
UDPCLient
*
newTarget
=
new
UDPCLient
(
target
);
_targetHosts
.
append
(
newTarget
);
}
...
...
@@ -403,10 +401,8 @@ void UDPConfiguration::_copyFrom(LinkConfiguration *source)
void
UDPConfiguration
::
_clearTargetHosts
()
{
while
(
_targetHosts
.
size
())
{
delete
_targetHosts
.
last
();
_targetHosts
.
removeLast
();
}
qDeleteAll
(
_targetHosts
);
_targetHosts
.
clear
();
}
/**
...
...
@@ -433,7 +429,7 @@ void UDPConfiguration::addHost(const QString& host, quint16 port)
qWarning
()
<<
"UDP:"
<<
"Could not resolve host:"
<<
host
<<
"port:"
<<
port
;
}
else
{
QHostAddress
address
(
ipAdd
);
if
(
!
contains
t
_target
(
_targetHosts
,
address
,
port
))
{
if
(
!
contains_target
(
_targetHosts
,
address
,
port
))
{
UDPCLient
*
newTarget
=
new
UDPCLient
(
address
,
port
);
_targetHosts
.
append
(
newTarget
);
_updateHostList
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment