2005-08-17 jrandom
* Revise the SSU peer testing protocol so that Bob verifies Charlie's viability before agreeing to Alice's request. This doesn't work with older SSU peer test builds, but is backwards compatible (older nodes won't ask newer nodes to participate in tests, and newer nodes won't ask older nodes to either).
This commit is contained in:
@ -44,19 +44,19 @@ public class Base64 {
|
||||
|
||||
/** added by aum */
|
||||
public static String encode(String source) {
|
||||
return encode(source.getBytes());
|
||||
return (source != null ? encode(source.getBytes()) : "");
|
||||
}
|
||||
public static String encode(byte[] source) {
|
||||
return encode(source, 0, (source != null ? source.length : 0));
|
||||
return (source != null ? encode(source, 0, (source != null ? source.length : 0)) : "");
|
||||
}
|
||||
public static String encode(byte[] source, int off, int len) {
|
||||
return encode(source, off, len, false);
|
||||
return (source != null ? encode(source, off, len, false) : "");
|
||||
}
|
||||
public static String encode(byte[] source, boolean useStandardAlphabet) {
|
||||
return encode(source, 0, (source != null ? source.length : 0), useStandardAlphabet);
|
||||
return (source != null ? encode(source, 0, (source != null ? source.length : 0), useStandardAlphabet) : "");
|
||||
}
|
||||
public static String encode(byte[] source, int off, int len, boolean useStandardAlphabet) {
|
||||
return safeEncode(source, off, len, useStandardAlphabet);
|
||||
return (source != null ? safeEncode(source, off, len, useStandardAlphabet) : "");
|
||||
}
|
||||
|
||||
public static byte[] decode(String s) {
|
||||
|
@ -642,7 +642,7 @@ public class LogManager {
|
||||
|
||||
public void shutdown() {
|
||||
_log.log(Log.WARN, "Shutting down logger");
|
||||
_writer.flushRecords();
|
||||
_writer.flushRecords(false);
|
||||
}
|
||||
|
||||
private static int __id = 0;
|
||||
|
@ -59,7 +59,8 @@ class LogWriter implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
public void flushRecords() {
|
||||
public void flushRecords() { flushRecords(true); }
|
||||
public void flushRecords(boolean shouldWait) {
|
||||
try {
|
||||
List records = _manager._removeAll();
|
||||
if (records == null) return;
|
||||
@ -77,11 +78,13 @@ class LogWriter implements Runnable {
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
synchronized (this) {
|
||||
this.wait(10*1000);
|
||||
if (shouldWait) {
|
||||
try {
|
||||
synchronized (this) {
|
||||
this.wait(10*1000);
|
||||
}
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user