mirror of https://github.com/zlatinb/muwire
connect more aggressively, send more pongs, fix destination parsing and header check
parent
4e09b4ad71
commit
837b8d8213
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue