Procházet zdrojové kódy

include previous key file contents when adding key. do not delete temp files, since they will be renamed to the auth file. if they're left around, the temp cleaner will get them

tags/v1.1.0^0
Jonathan Cobb před 4 roky
rodič
revize
1e6684a20a
1 změnil soubory, kde provedl 3 přidání a 2 odebrání
  1. +3
    -2
      bubble-server/src/main/java/bubble/service/device/StandardFlexRouterService.java

+ 3
- 2
bubble-server/src/main/java/bubble/service/device/StandardFlexRouterService.java Zobrazit soubor

@@ -243,8 +243,9 @@ public class StandardFlexRouterService extends SimpleDaemon implements FlexRoute
if (Arrays.stream(lines).anyMatch(line -> line.trim().equals(trimmedKey))) {
if (log.isDebugEnabled()) log.debug("allowKey: already present: "+trimmedKey);
} else {
@Cleanup("delete") final File temp = temp("flex_keys_", ".tmp");
final File temp = temp("flex_keys_", ".tmp");
final String dataToWrite = authFileContents != null && authFileContents.endsWith("\n") ? trimmedKey + "\n" : "\n" + trimmedKey + "\n";
toFileOrDie(temp, authFileContents, true);
toFileOrDie(temp, dataToWrite, true);
renameOrDie(temp, authFile);
if (log.isInfoEnabled()) log.info("allowKey: added key: "+trimmedKey);
@@ -267,7 +268,7 @@ public class StandardFlexRouterService extends SimpleDaemon implements FlexRoute
}
}
b.append("\n");
@Cleanup("delete") final File temp = temp("flex_keys_", ".tmp");
final File temp = temp("flex_keys_", ".tmp");
toFileOrDie(temp, b.toString());
renameOrDie(temp, authFile);
if (found) {


Načítá se…
Zrušit
Uložit