updater checks length as well as time, in case there are multiple

modifications within the same second
sigsegv_dump
Greg Alexander 10 years ago
parent 52a1093dde
commit a40b35a5a2

@ -7,6 +7,7 @@ public class UpdaterThread extends Thread {
public void run() { public void run() {
File f = new File(Prefs.get_path(), "dropbear.err"); File f = new File(Prefs.get_path(), "dropbear.err");
long lastmod = 0; long lastmod = 0;
long lastlen = 0;
System.out.println("sshd: updater start"); System.out.println("sshd: updater start");
while (true) { while (true) {
if (isInterrupted()) { if (isInterrupted()) {
@ -17,15 +18,27 @@ System.out.println("sshd: updater interrupted");
System.out.println("sshd: activity stopped"); System.out.println("sshd: activity stopped");
break; break;
} }
long l = f.lastModified(); long mod = f.lastModified();
if (l != lastmod) { long len = f.length();
System.out.println("sshd: updating"); if (mod != lastmod) {
System.out.println("sshd: updating for time");
SimpleSSHD.curr.runOnUiThread(new Thread() { SimpleSSHD.curr.runOnUiThread(new Thread() {
public void run() { public void run() {
SimpleSSHD.curr.update_log(); SimpleSSHD.curr.update_log();
} }
}); });
lastmod = l; lastmod = mod;
lastlen = len;
}
if (len != lastlen) {
System.out.println("sshd: updating for len");
SimpleSSHD.curr.runOnUiThread(new Thread() {
public void run() {
SimpleSSHD.curr.update_log();
}
});
lastmod = mod;
lastlen = len;
} }
try { try {
sleep(1000); sleep(1000);

Loading…
Cancel
Save