Skip to content
Snippets Groups Projects
Commit 2a50f619 authored by Britta Heymann's avatar Britta Heymann
Browse files

Prevent calling getPredFor on broadcasts

parent 5291b106
No related branches found
No related tags found
1 merge request!155Fix prophet routing
Pipeline #
......@@ -12,6 +12,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import core.BroadcastMessage;
import core.DataMessage;
import core.MulticastMessage;
import routing.util.DatabaseApplicationUtil;
......@@ -285,8 +286,12 @@ public class ProphetRouter extends ActiveRouter {
availableConnections.add(con);
for (Message m : msgCollection) {
if (othRouter.hasMessage(m.getId())) {
continue; // skip messages that the other one has
if (othRouter.hasMessage(m.getId()) || m instanceof BroadcastMessage) {
// Ignore both messages that the other one has and all broadcast messages.
// (Broadcasts should be sent via exchangeDeliverableMessages.)
// The latter check may not be caught by the former because of caching (direct messages may be
// sent belatedly; see explanation at ActiveRouter#cachedMessagesForConnected.).
continue;
}
if (othRouter.getPredFor(m) > getPredFor(m)) {
// the other node has higher probability of delivery
......
  • Contributor

    SonarQube analysis reported 1 issue

    • 1 major
    1. Remove this unused private "getMaxPredFor" method. 📘
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment