|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.transport.tcp.TCPConnection
public class TCPConnection
Central choke point for a single TCP connection to a single peer.
Field Summary | |
---|---|
static double |
DEFAULT_QUEUE_FREE_FACTOR
by default, try to keep the queue completely full, but this can be overridden with the property 'tcp.queueFreeFactor' |
Constructor Summary | |
---|---|
TCPConnection(RouterContext ctx)
|
Method Summary | |
---|---|
void |
addMessage(OutNetMessage msg)
Add the given message to the outbound queue, notifying our runners that we want to send it. |
java.util.List |
clearPendingMessages()
Pull off any unsent OutNetMessages from the queue |
void |
closeConnection()
Disconnect from the peer immediately. |
void |
closeConnection(boolean wasError)
|
Hash |
getAttemptedPeer()
Who we initially were trying to contact |
(package private) boolean |
getIsActive()
|
(package private) boolean |
getIsClosed()
Have we been closed already? |
boolean |
getIsOutbound()
|
long |
getLifetime()
How long has this connection been active for? |
(package private) OutNetMessage |
getNextMessage()
Blocking call to retrieve the next pending message. |
long |
getOffsetReceived()
skew that the other peer has from our clock |
(package private) java.io.OutputStream |
getOutputStream()
Where this connection should write its data to. |
TCPAddress |
getRemoteAddress()
What is the peer's TCP address (using the IP address not hostname) |
RouterIdentity |
getRemoteRouterIdentity()
Who are we talking with (or null if not identified) |
(package private) RouterContext |
getRouterContext()
|
long |
getSendRate()
how many Bps we are sending data to the peer (or 2KBps if we don't know) |
java.lang.String |
getShownAddress()
What address the peer said we are reachable on |
TCPTransport |
getTransport()
|
(package private) void |
messageReceived()
|
void |
runConnection()
Actually start processing the messages on the connection (and reading from the peer, of course). |
(package private) void |
sent(OutNetMessage msg,
boolean ok,
long time)
The message was sent. |
void |
setAttemptedPeer(Hash peer)
Who we initially were trying to contact |
(package private) void |
setInputStream(java.io.InputStream in)
Configure where this connection should read its data from. |
void |
setIsOutbound(boolean outbound)
|
void |
setOffsetReceived(long ms)
|
(package private) void |
setOutputStream(java.io.OutputStream out)
Configure where this connection should write its data to. |
void |
setRemoteAddress(TCPAddress addr)
What is the peer's TCP address (using the IP address not hostname) |
void |
setRemoteRouterIdentity(RouterIdentity ident)
Who are we talking with (or null if not identified) |
void |
setShownAddress(java.lang.String ip)
What address the peer said we are reachable on |
(package private) void |
setSocket(java.net.Socket socket)
Configure what underlying socket this connection uses. |
(package private) void |
setTransport(TCPTransport transport)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double DEFAULT_QUEUE_FREE_FACTOR
Constructor Detail |
---|
public TCPConnection(RouterContext ctx)
Method Detail |
---|
public RouterIdentity getRemoteRouterIdentity()
public TCPAddress getRemoteAddress()
public Hash getAttemptedPeer()
public void setRemoteRouterIdentity(RouterIdentity ident)
public void setRemoteAddress(TCPAddress addr)
public void setAttemptedPeer(Hash peer)
public void setShownAddress(java.lang.String ip)
public java.lang.String getShownAddress()
public long getOffsetReceived()
public void setOffsetReceived(long ms)
public TCPTransport getTransport()
public boolean getIsOutbound()
public void setIsOutbound(boolean outbound)
public void runConnection()
public void closeConnection()
public void closeConnection(boolean wasError)
public java.util.List clearPendingMessages()
public void addMessage(OutNetMessage msg)
public long getSendRate()
OutNetMessage getNextMessage()
public long getLifetime()
void setTransport(TCPTransport transport)
void setInputStream(java.io.InputStream in)
void setOutputStream(java.io.OutputStream out)
void setSocket(java.net.Socket socket)
java.io.OutputStream getOutputStream()
boolean getIsClosed()
RouterContext getRouterContext()
boolean getIsActive()
void messageReceived()
void sent(OutNetMessage msg, boolean ok, long time)
msg
- message in questionok
- was the message sent ok?time
- how long did it take to write the message?
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |