Commit cf9dddf0 authored by zeroleak's avatar zeroleak
Browse files

fix lockDirectory on setExternalDestination

parent f74cbc88
......@@ -38,6 +38,9 @@ public class CliConfigController extends AbstractRestController {
ApiCliConfig apiCliConfig = payload.getConfig();
cliConfigService.setApiConfig(apiCliConfig);
// restart
Application.restart();
}
@RequestMapping(value = CliApiEndpoint.REST_CLI_CONFIG, method = RequestMethod.DELETE)
......
......@@ -5,7 +5,6 @@ import com.samourai.wallet.api.pairing.PairingPayload;
import com.samourai.wallet.crypto.AESUtil;
import com.samourai.wallet.util.CallbackWithArg;
import com.samourai.wallet.util.CharSequenceX;
import com.samourai.whirlpool.cli.Application;
import com.samourai.whirlpool.cli.api.protocol.beans.ApiCliConfig;
import com.samourai.whirlpool.cli.beans.CliStatus;
import com.samourai.whirlpool.cli.beans.WhirlpoolPairingPayload;
......@@ -213,8 +212,8 @@ public class CliConfigService {
// save
saveProperties(props);
// restart
Application.restart();
// restart needed
this.setCliStatusNotReady("ApiConfig updated. Restarting CLI...");
}
public synchronized void setExternalDestination(
......@@ -250,8 +249,8 @@ public class CliConfigService {
// save
saveProperties(props);
// restart
Application.restart();
// restart needed
this.setCliStatusNotReady("ExternalDestination updated. Restarting CLI...");
}
public synchronized void clearExternalDestination() throws Exception {
......@@ -269,8 +268,8 @@ public class CliConfigService {
// save
saveProperties(props);
// restart
Application.restart();
// restart needed
this.setCliStatusNotReady("ExternalDestination updated. Restarting CLI...");
}
public synchronized void setVersion(int version) throws Exception {
......
......@@ -92,6 +92,12 @@ public class CliService {
return dirFileLock;
}
private void unlockDirectory(FileLock dirFileLock) throws Exception {
ClientUtils.unlockFile(dirFileLock);
File dirLockFile = computeDirLockFile();
dirLockFile.delete();
}
public CliResult run(boolean listen) throws Exception {
String[] args = appArgs.getApplicationArguments().getSourceArgs();
......@@ -220,8 +226,7 @@ public class CliService {
return CliResult.KEEP_RUNNING;
}
} finally {
ClientUtils.unlockFile(dirFileLock);
computeDirLockFile().delete();
unlockDirectory(dirFileLock);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment