|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object seda.sandStorm.core.SimpleSink seda.sandStorm.lib.Gnutella.GnutellaConnection
public class GnutellaConnection
A GnutellaConnection represents a virtual connection to the Gnutella network. It may implement a single point-to-point connection between two peers, or a one-to-many connection to multiple peers.
Field Summary | |
---|---|
private java.net.InetAddress |
addr
|
private boolean |
closed
|
private ATcpConnection |
conn
|
private static boolean |
DEBUG
|
private GnutellaPacketReader |
gpr
|
private GnutellaServer |
gs
|
private int |
port
|
Fields inherited from interface seda.sandStorm.lib.Gnutella.GnutellaConst |
---|
DEFAULT_DOWNLOAD_PORT, DEFAULT_GNUTELLA_PORT, DEFAULT_HOPS, DEFAULT_PING_INTERVAL, DEFAULT_SPEED, DEFAULT_TTL, GNUTELLA_CONNECT, GNUTELLA_FN_PING, GNUTELLA_FN_PONG, GNUTELLA_FN_PUSH, GNUTELLA_FN_QUERY, GNUTELLA_FN_QUERYHITS, GNUTELLA_OK, MAX_PAYLOAD_SIZE, PACKET_HEADER_SIZE, WRITE_CLOG_THRESHOLD |
Constructor Summary | |
---|---|
GnutellaConnection(GnutellaServer gs,
ATcpConnection conn)
|
Method Summary | |
---|---|
void |
close(SinkIF compQ)
|
void |
enqueue_abort(java.lang.Object key)
Not supported; throws an IllegalArgumentException. |
void |
enqueue_commit(java.lang.Object key)
Not supported; throws an IllegalArgumentException. |
boolean |
enqueue_lossy(QueueElementIF element)
Calls enqueue() and returns false if SinkException occurs. |
void |
enqueue_many(QueueElementIF[] elements)
Simply calls enqueue() on each item in the array. |
java.lang.Object |
enqueue_prepare(QueueElementIF[] enqueueMe)
Not supported; throws an IllegalArgumentException. |
void |
enqueue(QueueElementIF element)
Must be implemented by subclasses. |
void |
flush(SinkIF compQ)
|
java.net.InetAddress |
getAddress()
Return the InetAddress of the peer. |
(package private) ATcpConnection |
getConnection()
|
int |
getPort()
Return the port of the peer. |
(package private) GnutellaPacketReader |
getReader()
|
void |
sendPing()
Send a ping to this connection. |
void |
sendPing(int ttl)
Send a ping to this connection with the given TTL. |
int |
size()
Returns 0. |
java.lang.String |
toString()
|
Methods inherited from class seda.sandStorm.core.SimpleSink |
---|
getEnqueuePredicate, profileSize, setEnqueuePredicate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
private GnutellaServer gs
private GnutellaPacketReader gpr
private ATcpConnection conn
private java.net.InetAddress addr
private int port
private boolean closed
Constructor Detail |
---|
GnutellaConnection(GnutellaServer gs, ATcpConnection conn)
Method Detail |
---|
public java.net.InetAddress getAddress()
public int getPort()
public void sendPing()
public void sendPing(int ttl)
ATcpConnection getConnection()
GnutellaPacketReader getReader()
public void enqueue(QueueElementIF element) throws SinkException
SimpleSink
enqueue
in interface SinkIF
enqueue
in class SimpleSink
element
- The QueueElementIF
to enqueue
SinkFullException
- Indicates that the sink is temporarily full.
SinkClosedException
- Indicates that the sink is
no longer being serviced.
SinkException
public boolean enqueue_lossy(QueueElementIF element)
SimpleSink
enqueue_lossy
in interface SinkIF
enqueue_lossy
in class SimpleSink
element
- The QueueElementIF
to enqueue
public void enqueue_many(QueueElementIF[] elements) throws SinkException
SimpleSink
enqueue_many
in interface SinkIF
enqueue_many
in class SimpleSink
elements
- The element array to enqueue
SinkFullException
- Indicates that the sink is temporarily full.
SinkClosedException
- Indicates that the sink is
no longer being serviced.
SinkException
public int size()
SimpleSink
size
in interface SinkIF
size
in class SimpleSink
public void close(SinkIF compQ) throws SinkClosedException
SinkClosedException
public void flush(SinkIF compQ) throws SinkClosedException
SinkClosedException
public java.lang.Object enqueue_prepare(QueueElementIF[] enqueueMe) throws SinkException
SimpleSink
enqueue_prepare
in interface SinkIF
enqueue_prepare
in class SimpleSink
enqueueMe
- The element array to provisionally enqueue
SinkFullException
- Indicates that the sink is temporarily full
and that the requested elements could not be provisionally enqueued.
SinkClosedException
- Indicates that the sink is
no longer being serviced.
SinkException
enqueue_commit
,
enqueue_abort
public void enqueue_commit(java.lang.Object key)
SimpleSink
enqueue_commit
in interface SinkIF
enqueue_commit
in class SimpleSink
public void enqueue_abort(java.lang.Object key)
SimpleSink
enqueue_abort
in interface SinkIF
enqueue_abort
in class SimpleSink
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |