ensure readers are closed; ensure socks settings are applied
This commit is contained in:
parent
b4fa943fe9
commit
aa8ff95e29
|
@ -948,9 +948,11 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
|
|
||||||
private int getControlPort ()
|
private int getControlPort ()
|
||||||
{
|
{
|
||||||
|
File fileControl = new File(appBinHome,"control.txt");
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File fileControl = new File(appBinHome,"control.txt");
|
|
||||||
|
|
||||||
logNotice("Reading control port config file: " + fileControl.getAbsolutePath());
|
logNotice("Reading control port config file: " + fileControl.getAbsolutePath());
|
||||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(fileControl));
|
BufferedReader bufferedReader = new BufferedReader(new FileReader(fileControl));
|
||||||
|
@ -961,22 +963,23 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
if (line != null)
|
if (line != null)
|
||||||
{
|
{
|
||||||
String[] lineParts = line.split(":");
|
String[] lineParts = line.split(":");
|
||||||
return Integer.parseInt(lineParts[1]);
|
result = Integer.parseInt(lineParts[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bufferedReader.close();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException e)
|
catch (FileNotFoundException e)
|
||||||
{
|
{
|
||||||
logNotice("unable to get control port: no file yet");
|
logNotice("unable to get control port; no file at: " + fileControl.getAbsolutePath());
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
logNotice("unable to get control port IOException");
|
logNotice("unable to read control port config file");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkAddressAndCountry () throws IOException
|
private void checkAddressAndCountry () throws IOException
|
||||||
|
@ -2006,6 +2009,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
|
||||||
mBinder.updateConfiguration("SafeSocks", safeSocks ? "1" : "0", false);
|
mBinder.updateConfiguration("SafeSocks", safeSocks ? "1" : "0", false);
|
||||||
mBinder.updateConfiguration("TestSocks", "1", false);
|
mBinder.updateConfiguration("TestSocks", "1", false);
|
||||||
mBinder.updateConfiguration("WarnUnsafeSocks", "1", false);
|
mBinder.updateConfiguration("WarnUnsafeSocks", "1", false);
|
||||||
|
mBinder.saveConfiguration();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue