java.lang.Object
net.i2p.client.streaming.impl.ConnectionManager.Reason
Enclosing class:
ConnectionManager

private static class ConnectionManager.Reasonextends Object
Encapsulates a connection rejection reason with an optional Retry-After duration in seconds.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    How long the ban lasts.
    private final boolean
    True to keep the refusal out of the logs.
    private final String
    The refusal message to log.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Reason(String text, int secs)
    Record a rejection reason that logs at WARN on every occurrence.
    Reason(String text, int secs, boolean silentFlags)
    Record a rejection reason, optionally suppressing its WARN log.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    int
    Seconds for the Retry-After header.
    boolean
    Whether per-rejection logging should be suppressed.
    Text description of the reason.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • txt

      private final String txt
      The refusal message to log.
    • seconds

      private final int seconds
      How long the ban lasts.
    • silent

      private final boolean silent
      True to keep the refusal out of the logs.
  • Constructor Details

    • Reason

      public Reason(String text, int secs)
      Record a rejection reason that logs at WARN on every occurrence.
      Parameters:
      text - text recorded as the reason and returned by toString()
      secs - seconds for the Retry-After header
    • Reason

      public Reason(String text, int secs, boolean silentFlags)
      Record a rejection reason, optionally suppressing its WARN log.
      Parameters:
      text - text recorded as the reason and returned by toString()
      secs - seconds for the Retry-After header
      silentFlags - if true, suppress the per-rejection WARN log. Used for repeated rejections of an already-temp-banned dest so a hammering peer doesn't spam the log on every SYN.
  • Method Details

    • toString

      public String toString()
      Text description of the reason.
      Overrides:
      toString in class Object
    • getSeconds

      public int getSeconds()
      Seconds for the Retry-After header.
      Returns:
      the Retry-After delay in seconds, 0 for none
    • isSilent

      public boolean isSilent()
      Whether per-rejection logging should be suppressed.
      Returns:
      true to skip the WARN log for this rejection