mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Merge pull request #2952 from freimair/envelope_of_envelopes
Envelope of envelopes #2
This commit is contained in:
commit
d9e088f469
@ -33,5 +33,5 @@ public enum Capability {
|
||||
ACK_MSG,
|
||||
BSQ_BLOCK,
|
||||
DAO_STATE,
|
||||
ENVELOPE_OF_ENVELOPES
|
||||
BUNDLE_OF_ENVELOPES
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class CoreNetworkCapabilities {
|
||||
public static void setSupportedCapabilities(BisqEnvironment bisqEnvironment) {
|
||||
Capabilities.app.addAll(Capability.TRADE_STATISTICS, Capability.TRADE_STATISTICS_2, Capability.ACCOUNT_AGE_WITNESS, Capability.ACK_MSG);
|
||||
Capabilities.app.addAll(Capability.ENVELOPE_OF_ENVELOPES);
|
||||
Capabilities.app.addAll(Capability.BUNDLE_OF_ENVELOPES);
|
||||
|
||||
if (BisqEnvironment.isDaoActivated(bisqEnvironment)) {
|
||||
Capabilities.app.addAll(Capability.PROPOSAL, Capability.BLIND_VOTE, Capability.BSQ_BLOCK, Capability.DAO_STATE);
|
||||
|
@ -285,7 +285,7 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
|
||||
networkEnvelope.getClass().getSimpleName());
|
||||
|
||||
// check if BundleOfEnvelopes is supported
|
||||
if (getCapabilities().containsAll(new Capabilities(Capability.ENVELOPE_OF_ENVELOPES))) {
|
||||
if (getCapabilities().containsAll(new Capabilities(Capability.BUNDLE_OF_ENVELOPES))) {
|
||||
synchronized (lock) {
|
||||
// check if current envelope fits size
|
||||
// - no? create new envelope
|
||||
@ -299,7 +299,11 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
|
||||
bundleSender.schedule(() -> {
|
||||
if (!stopped) {
|
||||
synchronized (lock) {
|
||||
protoOutputStream.writeEnvelope(queueOfBundles.poll());
|
||||
BundleOfEnvelopes current = queueOfBundles.poll();
|
||||
if(current.getEnvelopes().size() == 1)
|
||||
protoOutputStream.writeEnvelope(current.getEnvelopes().get(0));
|
||||
else
|
||||
protoOutputStream.writeEnvelope(current);
|
||||
}
|
||||
}
|
||||
}, lastSendTimeStamp - now, TimeUnit.MILLISECONDS);
|
||||
|
Loading…
Reference in New Issue
Block a user