[bisq-network/bisq] Bundle of envelopes (#2939)

Florian Reimair notifications at github.com
Mon Jul 8 14:22:04 UTC 2019


freimair commented on this pull request.



> +                                        "for {} ms to avoid flooding our peer. lastSendTimeStamp={}, now={}, elapsed={}, networkEnvelope={}",
+                                sendMsgThrottleTrigger, sendMsgThrottleSleep, lastSendTimeStamp, now, elapsed,
+                                networkEnvelope.getClass().getSimpleName());
+
+                        // check if BundleOfEnvelopes is supported
+                        if(getCapabilities().containsAll(new Capabilities(Capability.ENVELOPE_OF_ENVELOPES))) {
+                            synchronized (lock) {
+                                // check if current envelope fits size
+                                // - no? create new envelope
+                                if(queueOfBundles.isEmpty() || queueOfBundles.element().toProtoNetworkEnvelope().getSerializedSize() + networkEnvelope.toProtoNetworkEnvelope().getSerializedSize() > MAX_PERMITTED_MESSAGE_SIZE * 0.9) {
+                                    // - no? create a bucket
+                                    queueOfBundles.add(new BundleOfEnvelopes());
+                                    System.err.println("added fresh container");
+
+                                    // - and schedule it for sending
+                                    lastSendTimeStamp += sendMsgThrottleSleep;

yes it will. that is exactly the point. if we handle it otherwise, we would be left with no DoS protection at all. Besides, these messages are not lost but send as a bundle. I tested it in the real Bisq network with 4 nodes with testing conditions to only send every 2 seconds. Yes, my queue once went up to 27 bundles to be sent but went down again as soon as traffic slowed.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/2939#discussion_r301120874
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190708/e1be5b26/attachment.html>


More information about the bisq-github mailing list