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
c29c83a9
Unverified
Commit
c29c83a9
authored
Apr 18, 2018
by
Gus Grubba
Committed by
GitHub
Apr 18, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6359 from mavlink/androidSkipLookup
Skip host lookup on Android
parents
6d13ae3a
453de983
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
10 deletions
+33
-10
QGCTileCacheWorker.cpp
src/QtLocationPlugin/QGCTileCacheWorker.cpp
+33
-10
No files found.
src/QtLocationPlugin/QGCTileCacheWorker.cpp
View file @
c29c83a9
...
...
@@ -188,18 +188,15 @@ QGCCacheWorker::run()
//-- Wait a bit before shutting things down
_waitmutex
.
lock
();
int
timeout
=
5000
;
if
(
!
_waitc
.
wait
(
&
_waitmutex
,
timeout
))
{
_waitmutex
.
unlock
();
_mutex
.
lock
();
//-- If nothing to do, close db and leave thread
if
(
!
_taskQueue
.
count
())
{
_mutex
.
unlock
();
break
;
}
_waitc
.
wait
(
&
_waitmutex
,
timeout
);
_waitmutex
.
unlock
();
_mutex
.
lock
();
//-- If nothing to do, close db and leave thread
if
(
!
_taskQueue
.
count
())
{
_mutex
.
unlock
();
break
;
}
_
wait
mutex
.
unlock
();
_mutex
.
unlock
();
}
}
if
(
_db
)
{
...
...
@@ -1094,15 +1091,40 @@ QGCCacheWorker::_createDB(QSqlDatabase* db, bool createDefault)
void
QGCCacheWorker
::
_testInternet
()
{
/*
To test if you have Internet connection, the code tests a connection to
8.8.8.8:53 (google DNS). It appears that some routers are now blocking TCP
connections to port 53. So instead, we use a TCP connection to "github.com"
(80). On exit, if the look up for “github.com” is under way, a call to abort
the lookup is made. This abort call on Android has no effect, and the code
blocks for a full minute. So to work around the issue, we continue a direct
TCP connection to 8.8.8.8:53 on Android and do the lookup/connect on the
other platforms.
*/
#if defined(__android__)
QTcpSocket
socket
;
socket
.
connectToHost
(
"8.8.8.8"
,
53
);
if
(
socket
.
waitForConnected
(
2000
))
{
qCDebug
(
QGCTileCacheLog
)
<<
"Yes Internet Access"
;
emit
internetStatus
(
true
);
return
;
}
qWarning
()
<<
"No Internet Access"
;
emit
internetStatus
(
false
);
#else
if
(
!
_hostLookupID
)
{
_hostLookupID
=
QHostInfo
::
lookupHost
(
"www.github.com"
,
this
,
SLOT
(
_lookupReady
(
QHostInfo
)));
}
#endif
}
//-----------------------------------------------------------------------------
void
QGCCacheWorker
::
_lookupReady
(
QHostInfo
info
)
{
#if defined(__android__)
Q_UNUSED
(
info
);
#else
_hostLookupID
=
0
;
if
(
info
.
error
()
==
QHostInfo
::
NoError
&&
info
.
addresses
().
size
())
{
QTcpSocket
socket
;
...
...
@@ -1118,4 +1140,5 @@ QGCCacheWorker::_lookupReady(QHostInfo info)
}
qWarning
()
<<
"No Internet Access"
;
emit
internetStatus
(
false
);
#endif
}
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