LimeWire Consolidated API

com.limegroup.gnutella
Class ConnectionServicesImpl

java.lang.Object
  extended by com.limegroup.gnutella.ConnectionServicesImpl
All Implemented Interfaces:
ConnectionServices

public class ConnectionServicesImpl
extends Object
implements ConnectionServices


Constructor Summary
ConnectionServicesImpl(com.google.inject.Provider<ConnectionManager> connectionManager, com.google.inject.Provider<HostCatcher> hostCatcher, com.google.inject.Provider<UDPMultiplexor> udpMultiplexor, com.google.inject.Provider<UploadManager> uploadManager, com.google.inject.Provider<Acceptor> acceptor, com.google.inject.Provider<SpamServices> spamServices)
           
 
Method Summary
 void connect()
          Connects to the network.
 void connectToHostAsynchronously(String hostname, int portnum, SocketsManager.ConnectType type)
          Creates a new outgoing messaging connection to the given host and port.
 int countConnectionsWithNMessages(int messageThreshold)
          Count how many connections have already received N messages
 void disconnect()
          Disconnects from the network.
 int getActiveConnectionMessages()
          Count up all the messages on active connections
 int getNumInitializedConnections()
          Returns the number of initialized messaging connections.
 Collection<IpPort> getPreferencedHosts(boolean isUltrapeer, String locale, int num)
          Returns a collection of IpPorts, preferencing hosts with open slots.
 boolean isActiveSuperNode()
          Tells whether the node is currently connected to the network as a supernode or not.
 boolean isConnected()
          Returns whether or not this client currently has any initialized connections.
 boolean isConnectedTo(InetAddress addr)
          Determines if you're connected to the given host.
 boolean isConnecting()
          Returns whether or not this client is attempting to connect.
 boolean isFullyConnected()
          Returns whether or not this client currently has any initialized connections.
 boolean isShieldedLeaf()
          Accessor for whether or not this node is a shielded leaf.
 boolean isSupernode()
          Tells whether the node is a supernode or not.
 void removeConnection(RoutedConnection c)
          Closes and removes the given connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionServicesImpl

@Inject
public ConnectionServicesImpl(com.google.inject.Provider<ConnectionManager> connectionManager,
                                     com.google.inject.Provider<HostCatcher> hostCatcher,
                                     com.google.inject.Provider<UDPMultiplexor> udpMultiplexor,
                                     com.google.inject.Provider<UploadManager> uploadManager,
                                     com.google.inject.Provider<Acceptor> acceptor,
                                     com.google.inject.Provider<SpamServices> spamServices)
Method Detail

isShieldedLeaf

public boolean isShieldedLeaf()
Description copied from interface: ConnectionServices
Accessor for whether or not this node is a shielded leaf.

Specified by:
isShieldedLeaf in interface ConnectionServices
Returns:
true if this node is a shielded leaf, false otherwise

isActiveSuperNode

public boolean isActiveSuperNode()
Description copied from interface: ConnectionServices
Tells whether the node is currently connected to the network as a supernode or not.

Specified by:
isActiveSuperNode in interface ConnectionServices
Returns:
true, if active supernode, false otherwise

isSupernode

public boolean isSupernode()
Description copied from interface: ConnectionServices
Tells whether the node is a supernode or not. NOTE: This will return true if this node is capable of being a supernode but is not yet connected to the network as one (and is not a shielded leaf either).

Specified by:
isSupernode in interface ConnectionServices
Returns:
true, if supernode, false otherwise

isConnecting

public boolean isConnecting()
Description copied from interface: ConnectionServices
Returns whether or not this client is attempting to connect.

Specified by:
isConnecting in interface ConnectionServices

isConnected

public boolean isConnected()
Description copied from interface: ConnectionServices
Returns whether or not this client currently has any initialized connections.

Specified by:
isConnected in interface ConnectionServices
Returns:
true if the client does have initialized connections, false otherwise

isFullyConnected

public boolean isFullyConnected()
Description copied from interface: ConnectionServices
Returns whether or not this client currently has any initialized connections.

Specified by:
isFullyConnected in interface ConnectionServices
Returns:
true if the client does have initialized connections, false otherwise

getPreferencedHosts

public Collection<IpPort> getPreferencedHosts(boolean isUltrapeer,
                                              String locale,
                                              int num)
Description copied from interface: ConnectionServices
Returns a collection of IpPorts, preferencing hosts with open slots. If isUltrapeer is true, this preferences hosts with open ultrapeer slots, otherwise it preferences hosts with open leaf slots. Preferences via locale, also.

Specified by:
getPreferencedHosts in interface ConnectionServices
num - How many endpoints to try to get

countConnectionsWithNMessages

public int countConnectionsWithNMessages(int messageThreshold)
Description copied from interface: ConnectionServices
Count how many connections have already received N messages

Specified by:
countConnectionsWithNMessages in interface ConnectionServices

getActiveConnectionMessages

public int getActiveConnectionMessages()
Description copied from interface: ConnectionServices
Count up all the messages on active connections

Specified by:
getActiveConnectionMessages in interface ConnectionServices

removeConnection

public void removeConnection(RoutedConnection c)
Description copied from interface: ConnectionServices
Closes and removes the given connection.

Specified by:
removeConnection in interface ConnectionServices

disconnect

public void disconnect()
Description copied from interface: ConnectionServices
Disconnects from the network. Closes all connections and sets the number of connections to zero.

Specified by:
disconnect in interface ConnectionServices

connect

public void connect()
Description copied from interface: ConnectionServices
Connects to the network. Ensures the number of messaging connections (keep-alive) is non-zero and recontacts the pong server as needed.

Specified by:
connect in interface ConnectionServices

isConnectedTo

public boolean isConnectedTo(InetAddress addr)
Description copied from interface: ConnectionServices
Determines if you're connected to the given host.

Specified by:
isConnectedTo in interface ConnectionServices

connectToHostAsynchronously

public void connectToHostAsynchronously(String hostname,
                                        int portnum,
                                        SocketsManager.ConnectType type)
Description copied from interface: ConnectionServices
Creates a new outgoing messaging connection to the given host and port. Returns immediately without blocking. If hostname would connect us to ourselves, returns immediately.

Specified by:
connectToHostAsynchronously in interface ConnectionServices

getNumInitializedConnections

public int getNumInitializedConnections()
Description copied from interface: ConnectionServices
Returns the number of initialized messaging connections.

Specified by:
getNumInitializedConnections in interface ConnectionServices

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.