|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.i2p.router.transport.TransportImpl
net.i2p.router.transport.ntcp.NTCPTransport
public class NTCPTransport
The NIO TCP transport
| Field Summary | |
|---|---|
static int |
ESTABLISH_TIMEOUT
how long from initial connection attempt (accept() or connect()) until the con must be established to avoid premature close()ing |
static String |
PROP_BIND_INTERFACE
this is rarely if ever used, default is to bind to wildcard address |
static String |
STYLE
|
| Fields inherited from class net.i2p.router.transport.TransportImpl |
|---|
_context, ADJUST_COST |
| Fields inherited from interface net.i2p.router.transport.Transport |
|---|
SOURCE_CONFIG, SOURCE_INTERFACE, SOURCE_UPNP |
| Constructor Summary | |
|---|---|
NTCPTransport(RouterContext ctx,
DHSessionKeyBuilder.Factory dh)
|
|
| Method Summary | |
|---|---|
void |
afterSend(OutNetMessage msg,
boolean sendSuccessful,
boolean allowRequeue,
long msToSend)
The transport is done sending this message. |
boolean |
allowConnection()
|
TransportBid |
bid(RouterInfo toAddress,
long dataSize)
|
int |
countActivePeers()
How many peers can we talk to right now? |
int |
countActiveSendPeers()
How many peers are we actively sending messages to (this minute) |
(package private) void |
establishing(NTCPConnection con)
add us to the establishment timeout process |
(package private) void |
expireTimedOut()
called in the EventPumper no more than once a second or so, closing any unconnected/unestablished connections |
void |
forwardPortStatus(int port,
int externalPort,
boolean success,
String reason)
If we didn't used to be forwarded, and we have an address, and we are configured to use UPnP, update our RouterAddress Don't do anything now. |
Vector<Long> |
getClockSkews()
Return our peer clock skews on this transport. |
(package private) DHSessionKeyBuilder |
getDHBuilder()
|
(package private) EventPumper |
getPumper()
|
short |
getReachabilityStatus()
Maybe we should trust UPnP here and report OK if it opened the port, but for now we don't. |
(package private) Reader |
getReader()
|
int |
getRequestedPort()
What port would the transport like to have forwarded by UPnP. |
String |
getStyle()
|
(package private) Writer |
getWriter()
|
(package private) void |
inboundEstablished(NTCPConnection con)
|
boolean |
isAlive()
|
boolean |
isBacklogged(Hash dest)
|
boolean |
isEstablished(Hash dest)
|
protected void |
outboundMessageReady()
This message is called whenever a new message is added to the send pool, and it should not block |
(package private) void |
removeCon(NTCPConnection con)
|
void |
renderStatusHTML(Writer out,
int sortFlags)
|
void |
renderStatusHTML(Writer out,
String urlBase,
int sortFlags)
|
RouterAddress |
restartListening(RouterAddress addr)
Only called by CSFI. |
(package private) void |
sendComplete(OutNetMessage msg)
queue up afterSend call, which can take some time w/ jobs, etc |
(package private) void |
setLastBadSkew(long skew)
|
RouterAddress |
startListening()
Called by TransportManager. |
void |
stopListening()
This doesn't (completely) block, caller should check isAlive() before calling startListening() or restartListening() |
| Methods inherited from class net.i2p.router.transport.TransportImpl |
|---|
afterSend, afterSend, afterSend, countPeers, externalAddressReceived, getContext, getCurrentAddress, getIP, getMaxConnections, getMostRecentErrorMessages, getNextMessage, haveCapacity, haveCapacity, isPubliclyRoutable, isUnreachable, markReachable, markUnreachable, markWasUnreachable, messageReceived, recheckReachability, renderStatusHTML, replaceAddress, send, setIP, setListener, updateAddress, wasUnreachable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PROP_BIND_INTERFACE
public static final int ESTABLISH_TIMEOUT
public static final String STYLE
| Constructor Detail |
|---|
public NTCPTransport(RouterContext ctx,
DHSessionKeyBuilder.Factory dh)
| Method Detail |
|---|
void inboundEstablished(NTCPConnection con)
protected void outboundMessageReady()
TransportImpl
outboundMessageReady in class TransportImpl
public void afterSend(OutNetMessage msg,
boolean sendSuccessful,
boolean allowRequeue,
long msToSend)
TransportImpl
afterSend in class TransportImplmsg - message in questionsendSuccessful - true if the peer received itallowRequeue - true if we should try other transports if availablemsToSend - how long it took to transfer the data to the peer
public TransportBid bid(RouterInfo toAddress,
long dataSize)
public boolean allowConnection()
void sendComplete(OutNetMessage msg)
public boolean isEstablished(Hash dest)
isEstablished in interface TransportisEstablished in class TransportImplpublic boolean isBacklogged(Hash dest)
isBacklogged in interface TransportisBacklogged in class TransportImplvoid removeCon(NTCPConnection con)
public int countActivePeers()
countActivePeers in interface TransportcountActivePeers in class TransportImplpublic int countActiveSendPeers()
countActiveSendPeers in interface TransportcountActiveSendPeers in class TransportImplvoid setLastBadSkew(long skew)
skew - in secondspublic Vector<Long> getClockSkews()
getClockSkews in interface TransportgetClockSkews in class TransportImplpublic RouterAddress startListening()
public RouterAddress restartListening(RouterAddress addr)
public boolean isAlive()
Reader getReader()
Writer getWriter()
public String getStyle()
EventPumper getPumper()
DHSessionKeyBuilder getDHBuilder()
void establishing(NTCPConnection con)
void expireTimedOut()
public void forwardPortStatus(int port,
int externalPort,
boolean success,
String reason)
forwardPortStatus in interface TransportforwardPortStatus in class TransportImplport - the internal portexternalPort - the external port, which for now should always be the same as
the internal port if the forwarding was successful.public int getRequestedPort()
TransportImpl
getRequestedPort in interface TransportgetRequestedPort in class TransportImplpublic short getReachabilityStatus()
getReachabilityStatus in interface TransportgetReachabilityStatus in class TransportImplpublic void stopListening()
public void renderStatusHTML(Writer out,
int sortFlags)
throws IOException
IOException
public void renderStatusHTML(Writer out,
String urlBase,
int sortFlags)
throws IOException
renderStatusHTML in interface TransportrenderStatusHTML in class TransportImplIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||