com.limegroup.gnutella
Class ForMeReplyHandler

java.lang.Object
  extended bycom.limegroup.gnutella.ForMeReplyHandler
All Implemented Interfaces:
ReplyHandler

public final class ForMeReplyHandler
extends java.lang.Object
implements ReplyHandler

This is the class that goes in the route table when a request is sent whose reply is for me.


Method Summary
 boolean allowNewPings()
          Returns whether or not to allow new pings from this ReplyHandler.
 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)
          If there are problems with the request, just ignore it.
 void handleQueryReply(QueryReply reply, ReplyHandler handler)
          Handle the QueryReply, failing silently
static ReplyHandler instance()
          Singleton accessor.
 boolean isGoodLeaf()
          Returns false, as this node is not a "connection" in the first place, and so could never have sent the requisite headers.
 boolean isGoodUltrapeer()
          Returns false, as this node is not a "connection" in the first place, and so could never have sent the requisite headers.
 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()
          Implements ReplyHandler interface.
 boolean isOpen()
          Returns true if the reply handler is still able to handle a reply.
 boolean isOutgoing()
           
 boolean isPersonalSpam(Message m)
           
 boolean isStable()
          Returns true to indicate that this node is always stable.
 boolean isSupernodeClientConnection()
          Returns whether or not this ReplyHandler sends replies from an Ultrapeer to a leaf.
 boolean isUltrapeerQueryRoutingConnection()
          Returns false, since this connection is me, and it's not possible to pass query routing tables to oneself.
 boolean supportsPongCaching()
          Returns true, since we always support pong caching.
 void updateHorizonStats(PingReply pingReply)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static ReplyHandler instance()
Singleton accessor.

Returns:
the ReplyHandler instance for this node

handlePingReply

public void handlePingReply(PingReply pingReply,
                            ReplyHandler handler)
Description copied from interface: ReplyHandler
Handle the PingReply, failing silently

Specified by:
handlePingReply in interface ReplyHandler

handleQueryReply

public void handleQueryReply(QueryReply reply,
                             ReplyHandler handler)
Description copied from interface: ReplyHandler
Handle the QueryReply, failing silently

Specified by:
handleQueryReply in interface ReplyHandler

handlePushRequest

public void handlePushRequest(PushRequest pushRequest,
                              ReplyHandler handler)
If there are problems with the request, just ignore it. There's no point in sending them a GIV to have them send a GET just to return a 404 or Busy or Malformed Request, etc..

Specified by:
handlePushRequest in interface ReplyHandler

isOpen

public boolean isOpen()
Description copied from interface: ReplyHandler
Returns true if the reply handler is still able to handle a reply.

Specified by:
isOpen in interface ReplyHandler

getNumMessagesReceived

public int getNumMessagesReceived()
Specified by:
getNumMessagesReceived in interface ReplyHandler

countDroppedMessage

public void countDroppedMessage()
Specified by:
countDroppedMessage in interface ReplyHandler

isSupernodeClientConnection

public boolean isSupernodeClientConnection()
Description copied from interface: ReplyHandler
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.

Specified by:
isSupernodeClientConnection in interface ReplyHandler
Returns:
true if this node is an Ultrapeer, and the node it is sending replies to is a leaf, otherwise returns false

getDomains

public java.util.Set getDomains()
Specified by:
getDomains in interface ReplyHandler

isPersonalSpam

public boolean isPersonalSpam(Message m)
Specified by:
isPersonalSpam in interface ReplyHandler

updateHorizonStats

public void updateHorizonStats(PingReply pingReply)

isOutgoing

public boolean isOutgoing()
Specified by:
isOutgoing in interface ReplyHandler

isKillable

public boolean isKillable()
Description copied from interface: ReplyHandler
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.

Specified by:
isKillable in interface ReplyHandler
Returns:
true if the handler is 'killable', i.e. a clip2 indexing query, otherwise false

isLeafConnection

public boolean isLeafConnection()
Implements ReplyHandler interface. Returns whether this node is a leaf or an Ultrapeer.

Specified by:
isLeafConnection in interface ReplyHandler
Returns:
true if this node is a leaf node, otherwise false

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. Because this connection really represents just this node, it always returns false/

Specified by:
isHighDegreeConnection in interface ReplyHandler
Returns:
false, since this reply handler signifies only this node -- its connections don't matter.

isUltrapeerQueryRoutingConnection

public boolean isUltrapeerQueryRoutingConnection()
Returns false, since this connection is me, and it's not possible to pass query routing tables to oneself.

Specified by:
isUltrapeerQueryRoutingConnection in interface ReplyHandler
Returns:
false, since you cannot pass query routing tables to yourself

isGoodUltrapeer

public boolean isGoodUltrapeer()
Returns false, as this node is not a "connection" in the first place, and so could never have sent the requisite headers.

Specified by:
isGoodUltrapeer in interface ReplyHandler
Returns:
false, as this node is not a real connection

isGoodLeaf

public boolean isGoodLeaf()
Returns false, as this node is not a "connection" in the first place, and so could never have sent the requisite headers.

Specified by:
isGoodLeaf in interface ReplyHandler
Returns:
false, as this node is not a real connection

supportsPongCaching

public boolean supportsPongCaching()
Returns true, since we always support pong caching.

Specified by:
supportsPongCaching in interface ReplyHandler
Returns:
true since this node always supports pong caching (since it's us)

allowNewPings

public boolean allowNewPings()
Returns whether or not to allow new pings from this ReplyHandler. Since this ping is from us, we'll always allow it.

Specified by:
allowNewPings in interface ReplyHandler
Returns:
true since this ping is from us

getInetAddress

public java.net.InetAddress getInetAddress()
Description copied from interface: ReplyHandler
Accessor for the InetAddress instance for this host.

Specified by:
getInetAddress in interface ReplyHandler
Returns:
the InetAddress instance for this host

isStable

public boolean isStable()
Returns true to indicate that this node is always stable. Simply the fact that this method is being called indicates that the code is alive and stable (I think, therefore I am...).

Specified by:
isStable in interface ReplyHandler
Returns:
true since, this node is always stable