LimeWire Consolidated API

com.limegroup.gnutella
Class ForMeReplyHandler

java.lang.Object
  extended by com.limegroup.gnutella.ForMeReplyHandler
All Implemented Interfaces:
ReplyHandler, IpPort, SecureMessageCallback

public class ForMeReplyHandler
extends Object
implements ReplyHandler, SecureMessageCallback

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


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.limewire.io.IpPort
IpPort.IpComparator, IpPort.IpPortComparator
 
Field Summary
 
Fields inherited from interface org.limewire.io.IpPort
COMPARATOR, EMPTY_LIST, EMPTY_SET, IP_COMPARATOR
 
Method Summary
static boolean addXMLToResponses(QueryReply qr, LimeXMLDocumentHelper limeXMLDocumentHelper)
          Adds XML to the responses in a QueryReply.
 boolean allowNewPings()
          Returns whether or not to allow new pings from this ReplyHandler.
 void countDroppedMessage()
           
 String getAddress()
          Assessor for the address string.
 byte[] getClientGUID()
          Gets the clientGUID of this ReplyHandler.
 InetAddress getInetAddress()
          Assessor for the InetAddress for this host.
 InetSocketAddress getInetSocketAddress()
          Accessor for the InetSocketAddress that can describe the IP & Port.
 String getLocalePref()
          access the locale thats associated with this replyhandler
 int getNumMessagesReceived()
           
 int getPort()
          Assessor for the port this host is listening on.
 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
 void handleQueryReply(QueryReply reply, ReplyHandler handler, Address address)
          Handles a query reply locally.
 void handleSecureMessage(SecureMessage sm, boolean passed)
          Notification that a message is secure.
 void handleSimppVM(SimppVM simppVM)
          Handles SimppVM
 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.
 void register(ScheduledExecutorService backgroundExecutor, ServiceScheduler serviceScheduler)
           
 void reply(Message m)
          drops the message
 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

register

@Inject
public void register(ScheduledExecutorService backgroundExecutor,
                            ServiceScheduler serviceScheduler)

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

handleQueryReply

public void handleQueryReply(QueryReply reply,
                             ReplyHandler handler,
                             Address address)
Handles a query reply locally.

Parameters:
address - can be null, if not null overrides the address info in reply

handleSecureMessage

public void handleSecureMessage(SecureMessage sm,
                                boolean passed)
Notification that a message is secure. Currently only possible for a QueryReply.

Specified by:
handleSecureMessage in interface SecureMessageCallback

addXMLToResponses

public static boolean addXMLToResponses(QueryReply qr,
                                        LimeXMLDocumentHelper limeXMLDocumentHelper)
Adds XML to the responses in a QueryReply.


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

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 InetAddress getInetAddress()
Description copied from interface: IpPort
Assessor for the InetAddress for this host.

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

getInetSocketAddress

public InetSocketAddress getInetSocketAddress()
Description copied from interface: IpPort
Accessor for the InetSocketAddress that can describe the IP & Port.

Specified by:
getInetSocketAddress in interface IpPort
Returns:
the InetSocketAddress of this host.

getPort

public int getPort()
Description copied from interface: IpPort
Assessor for the port this host is listening on.

Specified by:
getPort in interface IpPort
Returns:
the port this host is listening on

getAddress

public String getAddress()
Description copied from interface: IpPort
Assessor for the address string.

Specified by:
getAddress in interface IpPort
Returns:
the address of this host as a string

handleSimppVM

public void handleSimppVM(SimppVM simppVM)
Description copied from interface: ReplyHandler
Handles SimppVM

Specified by:
handleSimppVM in interface ReplyHandler

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

getLocalePref

public String getLocalePref()
Description copied from interface: ReplyHandler
access the locale thats associated with this replyhandler

Specified by:
getLocalePref in interface ReplyHandler

reply

public void reply(Message m)
drops the message

Specified by:
reply in interface ReplyHandler

getClientGUID

public byte[] getClientGUID()
Description copied from interface: ReplyHandler
Gets the clientGUID of this ReplyHandler.

Specified by:
getClientGUID in interface ReplyHandler

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.