Skip to content
This repository was archived by the owner on Dec 18, 2022. It is now read-only.

Commit 5682c45

Browse files
authored
Merge pull request thaliproject#131 from sisbell/july_fixes
Config and Startup Fixes
2 parents 2e8b11b + fcebb29 commit 5682c45

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ buildscript {
1414
}
1515

1616
android {
17-
compileSdkVersion 26
17+
compileSdkVersion 28
1818

1919
defaultConfig {
2020
minSdkVersion 16
21-
targetSdkVersion 26
21+
targetSdkVersion 28
2222
versionCode 1
2323
versionName "0.0.3"
2424
consumerProguardFiles 'proguard-rules.pro'
@@ -69,7 +69,7 @@ dependencies {
6969
implementation 'net.freehaven.tor.control:jtorctl:0.2'
7070
implementation 'org.slf4j:slf4j-api:1.7.25'
7171
implementation 'org.slf4j:slf4j-android:1.7.25'
72-
implementation 'com.android.support:appcompat-v7:26.1.0'
72+
implementation 'com.android.support:appcompat-v7:28.0.0'
7373
testImplementation 'junit:junit:4.12'
7474
androidTestImplementation project(':android_tor_installer')
7575
androidTestImplementation 'org.torproject:tor-android-binary:0.3.5.8-rc-v2'

android_tor_installer/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ buildscript {
1414
}
1515

1616
android {
17-
compileSdkVersion 26
17+
compileSdkVersion 28
1818

1919
defaultConfig {
2020
minSdkVersion 16
21-
targetSdkVersion 26
21+
targetSdkVersion 28
2222
versionCode 1
2323
versionName "0.0.3"
2424

universal/src/main/java/com/msopentech/thali/toronionproxy/OnionProxyManager.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,10 @@ private Process spawnTorProcess() throws IOException {
461461
LOG.warn(e.toString(), e);
462462
throw new IOException(e);
463463
}
464-
eatStream(torProcess.getErrorStream());
464+
eatStream(torProcess.getErrorStream(), true);
465+
if (getContext().getSettings().hasDebugLogs()) {
466+
eatStream(torProcess.getInputStream(), false);
467+
}
465468
return torProcess;
466469
}
467470

@@ -504,16 +507,20 @@ private void waitForCookieAuthFileCreation(File cookieAuthFile) throws IOExcepti
504507
LOG.info("Created cookie auth file: time = " + (System.currentTimeMillis() - cookieAuthStartTime) + "ms");
505508
}
506509

507-
private void eatStream(final InputStream inputStream) {
510+
private void eatStream(final InputStream inputStream, boolean isError) {
508511
new Thread() {
509512
@Override
510513
public void run() {
511514
Scanner scanner = new Scanner(inputStream);
512515
try {
513516
while (scanner.hasNextLine()) {
514-
String error = scanner.nextLine();
515-
LOG.error(error);
516-
eventBroadcaster.broadcastException(error, new Exception());
517+
String line = scanner.nextLine();
518+
if(isError) {
519+
LOG.error(line);
520+
eventBroadcaster.broadcastException(line, new Exception());
521+
} else {
522+
LOG.info(line);
523+
}
517524
}
518525
} finally {
519526
try {

universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public Builder fileCreationTimeout(int timeout) {
372372
public TorConfig build() {
373373
if(homeDir == null) {
374374
String userHome = System.getProperty("user.home");
375-
homeDir = (userHome != null && !"".equals(userHome)) ? new File(userHome) : configDir;
375+
homeDir = (userHome != null && !"".equals(userHome) && !"/".equals(userHome)) ? new File(userHome) : configDir;
376376
}
377377

378378
if (torExecutableFile == null) {

universal/src/main/java/com/msopentech/thali/toronionproxy/TorConfigBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ public TorConfigBuilder socksPort(String socksPort, String isolationFlag) {
395395
if (!isNullOrEmpty(isolationFlag)) {
396396
buffer.append(" ").append(isolationFlag);
397397
}
398+
buffer.append(" KeepAliveIsolateSOCKSAuth");
399+
buffer.append(" IPv6Traffic");
400+
buffer.append(" PreferIPv6");
401+
398402
buffer.append('\n');
399403
return this;
400404
}

0 commit comments

Comments
 (0)