Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
briar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Dehm
briar
Commits
9f8d12e6
Commit
9f8d12e6
authored
11 years ago
by
akwizgran
Browse files
Options
Downloads
Patches
Plain Diff
Extract latest Tor binary before starting Tor process. Dev task #81.
parent
a563fcc1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
briar-android/src/org/briarproject/plugins/tor/TorPlugin.java
+33
-13
33 additions, 13 deletions
...r-android/src/org/briarproject/plugins/tor/TorPlugin.java
with
33 additions
and
13 deletions
briar-android/src/org/briarproject/plugins/tor/TorPlugin.java
+
33
−
13
View file @
9f8d12e6
...
...
@@ -139,9 +139,14 @@ class TorPlugin implements DuplexPlugin, EventHandler {
startProcess
=
true
;
}
if
(
startProcess
)
{
// Install the binary, GeoIP database and config file if necessary
if
(!
isInstalled
()
&&
!
install
())
{
LOG
.
info
(
"Could not install Tor"
);
// Install the binary, possibly overwriting an older version
if
(!
installBinary
())
{
LOG
.
warning
(
"Could not install Tor binary"
);
return
false
;
}
// Install the GeoIP database and config file if necessary
if
(!
isConfigInstalled
()
&&
!
installConfig
())
{
LOG
.
info
(
"Could not install Tor config"
);
return
false
;
}
LOG
.
info
(
"Starting Tor"
);
...
...
@@ -219,11 +224,7 @@ class TorPlugin implements DuplexPlugin, EventHandler {
return
true
;
}
private
boolean
isInstalled
()
{
return
doneFile
.
exists
();
}
private
boolean
install
()
{
private
boolean
installBinary
()
{
InputStream
in
=
null
;
OutputStream
out
=
null
;
try
{
...
...
@@ -231,6 +232,30 @@ class TorPlugin implements DuplexPlugin, EventHandler {
in
=
getTorInputStream
();
out
=
new
FileOutputStream
(
torFile
);
copy
(
in
,
out
);
// Make the Tor binary executable
if
(!
setExecutable
(
torFile
))
{
LOG
.
warning
(
"Could not make Tor executable"
);
return
false
;
}
// Create a file to indicate that installation succeeded
doneFile
.
createNewFile
();
return
true
;
}
catch
(
IOException
e
)
{
if
(
LOG
.
isLoggable
(
WARNING
))
LOG
.
log
(
WARNING
,
e
.
toString
(),
e
);
tryToClose
(
in
);
tryToClose
(
out
);
return
false
;
}
}
private
boolean
isConfigInstalled
()
{
return
doneFile
.
exists
();
}
private
boolean
installConfig
()
{
InputStream
in
=
null
;
OutputStream
out
=
null
;
try
{
// Unzip the GeoIP database to the filesystem
in
=
getGeoIpInputStream
();
out
=
new
FileOutputStream
(
geoIpFile
);
...
...
@@ -239,11 +264,6 @@ class TorPlugin implements DuplexPlugin, EventHandler {
in
=
getConfigInputStream
();
out
=
new
FileOutputStream
(
configFile
);
copy
(
in
,
out
);
// Make the Tor binary executable
if
(!
setExecutable
(
torFile
))
{
LOG
.
warning
(
"Could not make Tor executable"
);
return
false
;
}
// Create a file to indicate that installation succeeded
doneFile
.
createNewFile
();
return
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment