com.limegroup.gnutella
Interface ReplyHandler

All Known Implementing Classes:
ForMeReplyHandler, ManagedConnection, UDPReplyHandler

public interface ReplyHandler

An interface for those things that handle replies and thus are placed as values in RouteTables. This interface is implemented by ManagedConnection and by MessageRouter.ForMeReplyHandler.


Method Summary
 boolean allowNewPings()
          Determines whether new pings should be allowed from this reply handler.
 void countDroppedMessage()
           
 java.util.Set getDomains()
           
 java.net.InetAddress getInetAddress()
          Accessor for the InetAddress instance for this host.
 int getNumMessagesReceived()
           
 void handlePingReply(PingReply pingReply, ReplyHandler handler)
          Handle the PingReply, failing silently
 void handlePushRequest(PushRequest pushRequest, ReplyHandler handler)
          Handle the PushRequest, failing silently
 void handleQueryReply(QueryReply queryReply, ReplyHandler handler)
          Handle the QueryReply, failing silently
 boolean isGoodLeaf()
          Returns whether or not this handler is considered a "good" leaf connection.
 boolean isGoodUltrapeer()
          Returns whether or not this handler is considered a "good" Ultrapeer connection.
 boolean isHighDegreeConnection()
          Returns whether or not this connection is a high-degree connection, meaning that it maintains a high number of intra-Ultrapeer connections.
 boolean isKillable()
          Returns whether or not this handler is killable by the handler watchdog.
 boolean isLeafConnection()
          Returns whether or not this reply handler is a leaf -- whether or not the host on the other end of this connection is a leaf of this (necessarily) Ultrapeer.
 boolean isOpen()
          Returns true if the reply handler is still able to handle a reply.
 boolean isOutgoing()
           
 boolean isPersonalSpam(Message m)
           
 boolean isStable()
          Determines whether or not this ReplyHandler is considered stable.
 boolean isSupernodeClientConnection()
          Returns whether or not this ReplyHandler sends replies from an Ultrapeer to a leaf.
 boolean isUltrapeerQueryRoutingConnection()
          Returns whether or not this handler uses Ultrapeer query routing.
 boolean supportsPongCaching()
          Returns whether or not this node supports pong caching.
 

Method Detail

handlePingReply

public void handlePingReply(PingReply pingReply,
                            ReplyHandler handler)
Handle the PingReply, failing silently


handleQueryReply

public void handleQueryReply(QueryReply queryReply,
                             ReplyHandler handler)
Handle the QueryReply, failing silently


handlePushRequest

public void handlePushRequest(PushRequest pushRequest,
                              ReplyHandler handler)
Handle the PushRequest, failing silently


getNumMessagesReceived

public int getNumMessagesReceived()

countDroppedMessage

public void countDroppedMessage()

getDomains

public java.util.Set getDomains()

isPersonalSpam

public boolean isPersonalSpam(Message m)

isOutgoing

public boolean isOutgoing()

isKillable

public boolean isKillable()
Returns whether or not this handler is killable by the handler watchdog. In particular, this is used for old Clip2 indexing queries, which should not be killed.

Returns:
true if the handler is 'killable', i.e. a clip2 indexing query, otherwise false

isSupernodeClientConnection

public boolean isSupernodeClientConnection()
Returns whether or not this ReplyHandler sends replies from an Ultrapeer to a leaf. This returns true only if this node is an Ultrapeer, and the node receiving these replies is a leaf of that Ultrapeer.

Returns:
true if this node is an Ultrapeer, and the node it is sending replies to is a leaf, otherwise returns false

isOpen

public boolean isOpen()
Returns true if the reply handler is still able to handle a reply.


isLeafConnection

public boolean isLeafConnection()
Returns whether or not this reply handler is a leaf -- whether or not the host on the other end of this connection is a leaf of this (necessarily) Ultrapeer.

Returns:
true if the host on the other end of this connection is a leaf, making this an Ultrapeer, false otherwise

isHighDegreeConnection

public boolean isHighDegreeConnection()
Returns whether or not this connection is a high-degree connection, meaning that it maintains a high number of intra-Ultrapeer connections.

Returns:
true if this is a 'high-degree' connection, otherwise false

isUltrapeerQueryRoutingConnection

public boolean isUltrapeerQueryRoutingConnection()
Returns whether or not this handler uses Ultrapeer query routing.

Returns:
true if this connection uses query routing between Ultrapeers, otherwise false

isGoodUltrapeer

public boolean isGoodUltrapeer()
Returns whether or not this handler is considered a "good" Ultrapeer connection. The definition of a good connection changes over time as new features are released.

Returns:
true if this is considered a good Ultrapeer connection, otherwise false

isGoodLeaf

public boolean isGoodLeaf()
Returns whether or not this handler is considered a "good" leaf connection. The definition of a good connection changes over time as new features are released.

Returns:
true if this is considered a good leaf connection, otherwise false

supportsPongCaching

public boolean supportsPongCaching()
Returns whether or not this node supports pong caching.

Returns:
true if this node supports pong caching, otherwise false

allowNewPings

public boolean allowNewPings()
Determines whether new pings should be allowed from this reply handler. Pings should only be accepted if we have not seen another ping from this handler in a given number of milliseconds, avoiding messages bursts.

Returns:
true if new pings are allowed, otherwise false

getInetAddress

public java.net.InetAddress getInetAddress()
Accessor for the InetAddress instance for this host.

Returns:
the InetAddress instance for this host

isStable

public boolean isStable()
Determines whether or not this ReplyHandler is considered stable. For TCP connections, this will mean that the connection has been alive for some minimal period of time, while UDP handlers will never be considered stable.

Returns:
true if this ReplyHandler has been up long enough to be considered "stable"