connect more aggressively, send more pongs, fix destination parsing and header check

binary-pongs
Zlatin Balevsky 2021-05-26 08:57:20 +01:00
parent 4e09b4ad71
commit 837b8d8213
No known key found for this signature in database
GPG Key ID: A72832072D525E41
4 changed files with 5 additions and 5 deletions

View File

@ -35,7 +35,7 @@ abstract class Connection implements Closeable {
private static final long INTERVAL = 1000
private static final MAX_PONGS_V1 = 2
private static final MAX_PONGS_V2 = 3
private static final MAX_PONGS_V2 = 4
final EventBus eventBus
final Endpoint endpoint

View File

@ -23,7 +23,7 @@ import net.i2p.util.ConcurrentHashSet
@Log
class ConnectionEstablisher {
private static final int CONCURRENT = 4
private static final int CONCURRENT = 8
final EventBus eventBus
final I2PConnector i2pConnector

View File

@ -51,7 +51,7 @@ class MessageUtil {
byte count = dis.readByte()
List<Destination> destinations = new ArrayList<>(count)
count.times {
destinations << Destination.create(dis)
destinations << Destination.create(dis).toBase64()
}
rv.pongs = destinations

View File

@ -43,7 +43,7 @@ class PeerConnection extends Connection {
protected void read() {
dis.readFully(readHeader)
int length = DataUtil.readLength(readHeader)
log.fine("$name read length $length")
log.fine("$name read length $length read header ${readHeader[0]}")
if (length > MAX_PAYLOAD_SIZE)
throw new Exception("Rejecting large message $length")
@ -52,7 +52,7 @@ class PeerConnection extends Connection {
dis.readFully(payload)
def json
if ((readHeader[0] & (byte)0x80) == 0x80) {
if ((readHeader[0] & (byte)0x80) == (byte)0x80) {
json = MessageUtil.parseBinaryMessage(payload)
} else {
json = slurper.parse(payload)