|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.HostCatcher
The host catcher. This peeks at pong messages coming on the network and snatches IP addresses of other Gnutella peers. IP addresses may also be added to it from a file (usually "gnutella.net"). The servent may then connect to these addresses as necessary to maintain full connectivity.
The HostCatcher currently prioritizes pongs as follows. Note that Ultrapeers with a private address is still highest priority; hopefully this may allow you to find local Ultrapeers.
Finally, HostCatcher maintains a list of "permanent" locations, based on average daily uptime. These are stored in the gnutella.net file. They are NOT bootstrap servers like router.limewire.com; LimeWire doesn't use those anymore.
Field Summary | |
static int |
GWEBCACHE_DELAY
The number of milliseconds to wait after trying gnutella.net entries before resorting to GWebCache HOSTFILE requests. |
Constructor Summary | |
HostCatcher()
Creates a new HostCatcher instance with a constant setting for the host file location. |
Method Summary | |
boolean |
add(Endpoint e,
boolean forceHighPriority)
Adds an address to this, possibly ejecting other elements from the cache. |
boolean |
add(PingReply pr)
Attempts to add a pong to this, possibly ejecting other elements from the cache. |
void |
clear()
|
void |
doneWithConnect(Endpoint e,
boolean success)
Notifies this that the fetcher has finished attempting a connection to the given host. |
void |
expire()
Notifies this that connect() has been called. |
Endpoint |
getAnEndpoint()
|
java.util.Iterator |
getHosts()
Returns an iterator of the hosts in this, in order of priority. |
int |
getNumHosts()
Return the number of hosts, i.e., getNumUltrapeerHosts()+getNumNormalHosts()+getNumPrivateHosts(). |
int |
getNumUltrapeerHosts()
Returns the number of marked ultrapeer hosts. |
java.util.Iterator |
getUltrapeerHosts(int n)
Returns an iterator of the (at most) n best ultrapeer endpoints of this. |
void |
initialize()
Links the HostCatcher up with the other back end pieces, and, if quick connect is not specified in the SettingsManager, loads the hosts in the host list into the maybe set. |
void |
removeHost(java.lang.String host,
int port)
Remove unwanted or used entries |
protected void |
repOk()
Checks invariants. |
void |
setAlwaysNotifyKnownHost(boolean notifyKnownHost)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int GWEBCACHE_DELAY
Constructor Detail |
public HostCatcher()
Method Detail |
public void initialize()
public boolean add(PingReply pr)
pr
- the pong containing the address/port to add
public boolean add(Endpoint e, boolean forceHighPriority)
forceHighPriority
- true if this should always be of high priority
public Endpoint getAnEndpoint() throws java.lang.InterruptedException
java.lang.InterruptedException
public void doneWithConnect(Endpoint e, boolean success)
e
- the address/port, which should have been returned by
getAnEndpointsuccess
- true if we successfully established a messaging connection
to e, at least temporarily; false otherwisepublic int getNumHosts()
public int getNumUltrapeerHosts()
public java.util.Iterator getHosts()
public java.util.Iterator getUltrapeerHosts(int n)
public void removeHost(java.lang.String host, int port)
public void expire()
public void clear()
public java.lang.String toString()
public void setAlwaysNotifyKnownHost(boolean notifyKnownHost)
protected void repOk()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |