Example #1
0
  /**
   * Purge all messages in window for local_addr, which are <= low. Check if the window's highest
   * received message is > high: if true, retransmit all messages from high - win.high to sender
   *
   * @param sender
   * @param highest_delivered
   * @param highest_seen
   */
  protected void stable(Address sender, short conn_id, long highest_delivered, long highest_seen) {
    SenderEntry entry = send_table.get(sender);
    AckSenderWindow win = entry != null ? entry.sent_msgs : null;
    if (win == null) return;

    if (log.isTraceEnabled())
      log.trace(
          new StringBuilder()
                  .append(local_addr)
                  .append(" <-- STABLE(")
                  .append(sender)
                  .append(": ")
                  .append(highest_delivered)
                  .append("-")
                  .append(highest_seen)
                  .append(", conn_id=" + conn_id)
              + ")");

    if (entry.send_conn_id != conn_id) {
      log.warn(
          local_addr
              + ": my conn_id ("
              + entry.send_conn_id
              + ") != received conn_id ("
              + conn_id
              + "); discarding STABLE message !");
      return;
    }

    win.ack(highest_delivered);
    long win_high = win.getHighest();
    if (win_high > highest_seen) {
      for (long seqno = highest_seen; seqno <= win_high; seqno++) {
        Message msg =
            win.get(
                seqno); // destination is still the same (the member which sent the STABLE message)
        if (msg != null) down_prot.down(new Event(Event.MSG, msg));
      }
    }
  }