Skip to content

Commit bbc7c14

Browse files
committed
Fixes thaliproject#114: Don't Delete CookieAuth file
1 parent c3aa521 commit bbc7c14

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@ public synchronized void start() throws IOException {
359359
if (!controlPortFile.getParentFile().exists()) controlPortFile.getParentFile().mkdirs();
360360

361361
File cookieAuthFile = getContext().getConfig().getCookieAuthFile();
362-
cookieAuthFile.delete();
363362
if (!cookieAuthFile.getParentFile().exists()) cookieAuthFile.getParentFile().mkdirs();
364363

365364
torProcess = spawnTorProcess();
@@ -484,6 +483,10 @@ private void waitForControlPortFileCreation(File controlPortFile) throws IOExcep
484483
* if the timeout for the cookie auth file to be created is exceeded, then an IOException is thrown.
485484
*/
486485
private void waitForCookieAuthFileCreation(File cookieAuthFile) throws IOException {
486+
if(cookieAuthFile.exists() && cookieAuthFile.length() != 0 ) {
487+
LOG.info("Cookie auth file already exists");
488+
return;
489+
}
487490
long cookieAuthStartTime = System.currentTimeMillis();
488491
LOG.info("Waiting for cookie auth file");
489492
boolean isCreated = cookieAuthFile.exists() || cookieAuthFile.createNewFile();

0 commit comments

Comments
 (0)