|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.client.streaming.Connection
class Connection
Maintain the state controlling a streaming connection between two destinations.
Nested Class Summary | |
---|---|
(package private) class |
Connection.ConEvent
fired to reschedule event notification |
(package private) class |
Connection.ResendPacketEvent
Coordinate the resends of a given packet |
Field Summary | |
---|---|
static int |
DISCONNECT_TIMEOUT
wait up to 5 minutes after disconnection so we can ack/close packets |
(package private) static int |
FAST_RETRANSMIT_THRESHOLD
If we have been explicitly NACKed three times, retransmit the packet even if there are other packets in flight. |
static long |
MAX_RESEND_DELAY
|
static int |
MAX_WINDOW_SIZE
|
static long |
MIN_RESEND_DELAY
|
Constructor Summary | |
---|---|
Connection(I2PAppContext ctx,
ConnectionManager manager,
SchedulerChooser chooser,
PacketQueue queue,
ConnectionPacketHandler handler)
|
|
Connection(I2PAppContext ctx,
ConnectionManager manager,
SchedulerChooser chooser,
PacketQueue queue,
ConnectionPacketHandler handler,
ConnectionOptions opts)
|
Method Summary | |
---|---|
(package private) void |
ackImmediately()
|
(package private) List<PacketLocal> |
ackPackets(long ackThrough,
long[] nacks)
Process the acks and nacks received in a packet |
(package private) void |
closeReceived()
|
(package private) void |
congestionOccurred()
|
(package private) void |
disconnect(boolean cleanDisconnect)
|
(package private) void |
disconnect(boolean cleanDisconnect,
boolean removeFromConMgr)
|
(package private) void |
disconnectComplete()
|
(package private) void |
eventOccurred()
|
long |
getAckedPackets()
how many packets have we sent and the other side has ACKed? |
long |
getCloseReceivedOn()
|
long |
getCloseSentOn()
|
long |
getCongestionWindowEnd()
|
String |
getConnectionError()
|
SimpleTimer.TimedEvent |
getConnectionEvent()
|
long |
getCreatedOn()
|
long |
getDisconnectScheduledOn()
|
boolean |
getHardDisconnected()
|
long |
getHighestAckedThrough()
|
MessageInputStream |
getInputStream()
stream that the local peer receives data on |
boolean |
getIsConnected()
|
long |
getLastActivityOn()
|
int |
getLastCongestionSeenAt()
|
long |
getLastSendId()
What was the last packet Id sent to the peer? |
long |
getLastSendTime()
When did we last send anything to the peer? |
long |
getLifetime()
|
long |
getLifetimeBytesReceived()
|
long |
getLifetimeBytesSent()
|
long |
getLifetimeDupMessagesReceived()
|
long |
getLifetimeDupMessagesSent()
|
long |
getNextOutboundPacketNum()
|
long |
getNextSendTime()
Time when the scheduler next want to send a packet, or -1 if never. |
ConnectionOptions |
getOptions()
Retrieve the current ConnectionOptions. |
MessageOutputStream |
getOutputStream()
stream that the local peer sends data to the remote peer on |
ConnectionPacketHandler |
getPacketHandler()
|
long |
getReceiveStreamId()
The stream ID of a peer connection that sends data to us. |
Destination |
getRemotePeer()
who are we talking with |
boolean |
getResetReceived()
|
boolean |
getResetSent()
|
long |
getResetSentOn()
|
long |
getSendStreamId()
what stream do we send data to the peer on? |
I2PSession |
getSession()
|
I2PSocketFull |
getSocket()
|
int |
getUnackedPacketsReceived()
|
int |
getUnackedPacketsSent()
how many packets have we sent but not yet received an ACK for? |
void |
incrementBytesReceived(int bytes)
|
void |
incrementBytesSent(int bytes)
|
void |
incrementDupMessagesReceived(int msgs)
|
void |
incrementDupMessagesSent(int msgs)
|
void |
incrementUnackedPacketsReceived()
|
boolean |
isInbound()
|
(package private) void |
packetReceived()
|
(package private) boolean |
packetSendChoke(long timeoutMs)
This doesn't "send a choke". |
(package private) void |
resetReceived()
|
(package private) void |
sendAvailable()
Flush any data that we can |
(package private) void |
sendPacket(PacketLocal packet)
|
(package private) void |
sendReset()
got a packet we shouldn't have, send 'em a reset |
void |
setCloseReceivedOn(long when)
|
void |
setCloseSentOn(long when)
|
void |
setCongestionWindowEnd(long endMsg)
|
void |
setConnectionError(String err)
|
void |
setHighestAckedThrough(long msgNum)
Deprecated. unused |
void |
setInbound()
|
void |
setLastSendId(long id)
Set the packet Id that was sent to a peer. |
void |
setLastSendTime(long when)
Set the time we sent data. |
void |
setNextSendTime(long when)
If the next send time is currently >= 0 (i.e. |
void |
setOptions(ConnectionOptions opts)
Set the ConnectionOptions. |
void |
setReceiveStreamId(long id)
|
void |
setRemotePeer(Destination peer)
|
void |
setSendStreamId(long id)
|
void |
setSocket(I2PSocketFull socket)
|
String |
toString()
|
void |
updateShareOpts()
|
(package private) void |
waitForConnect()
wait until a connection is made or the connection fails within the timeout period, setting the error accordingly. |
(package private) void |
windowAdjusted()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long MAX_RESEND_DELAY
public static final long MIN_RESEND_DELAY
public static final int DISCONNECT_TIMEOUT
public static final int MAX_WINDOW_SIZE
static final int FAST_RETRANSMIT_THRESHOLD
Constructor Detail |
---|
public Connection(I2PAppContext ctx, ConnectionManager manager, SchedulerChooser chooser, PacketQueue queue, ConnectionPacketHandler handler)
public Connection(I2PAppContext ctx, ConnectionManager manager, SchedulerChooser chooser, PacketQueue queue, ConnectionPacketHandler handler, ConnectionOptions opts)
Method Detail |
---|
public long getNextOutboundPacketNum()
void closeReceived()
boolean packetSendChoke(long timeoutMs)
timeoutMs
- 0 or negative means wait forever, 5 minutes max
void windowAdjusted()
void ackImmediately()
void sendReset()
void sendAvailable()
void sendPacket(PacketLocal packet)
List<PacketLocal> ackPackets(long ackThrough, long[] nacks)
void eventOccurred()
void resetReceived()
public boolean getResetReceived()
public void setInbound()
public boolean isInbound()
public boolean getIsConnected()
public boolean getHardDisconnected()
public boolean getResetSent()
public long getResetSentOn()
public long getDisconnectScheduledOn()
void disconnect(boolean cleanDisconnect)
void disconnect(boolean cleanDisconnect, boolean removeFromConMgr)
void disconnectComplete()
public Destination getRemotePeer()
public void setRemotePeer(Destination peer)
public long getSendStreamId()
public void setSendStreamId(long id)
public long getReceiveStreamId()
public void setReceiveStreamId(long id)
public long getLastSendTime()
public void setLastSendTime(long when)
when
- The time we sent datapublic long getLastSendId()
public void setLastSendId(long id)
id
- The packet IDpublic ConnectionOptions getOptions()
public void setOptions(ConnectionOptions opts)
opts
- ConnectionOptionspublic I2PSession getSession()
public I2PSocketFull getSocket()
public void setSocket(I2PSocketFull socket)
public String getConnectionError()
public void setConnectionError(String err)
public long getLifetime()
public ConnectionPacketHandler getPacketHandler()
public long getLifetimeBytesSent()
public long getLifetimeBytesReceived()
public long getLifetimeDupMessagesSent()
public long getLifetimeDupMessagesReceived()
public void incrementBytesSent(int bytes)
public void incrementDupMessagesSent(int msgs)
public void incrementBytesReceived(int bytes)
public void incrementDupMessagesReceived(int msgs)
public long getNextSendTime()
public void setNextSendTime(long when)
public long getAckedPackets()
public long getCreatedOn()
public long getCloseSentOn()
public void setCloseSentOn(long when)
public long getCloseReceivedOn()
public void setCloseReceivedOn(long when)
public void updateShareOpts()
public void incrementUnackedPacketsReceived()
public int getUnackedPacketsReceived()
public int getUnackedPacketsSent()
public long getCongestionWindowEnd()
public void setCongestionWindowEnd(long endMsg)
public long getHighestAckedThrough()
public void setHighestAckedThrough(long msgNum)
public long getLastActivityOn()
public int getLastCongestionSeenAt()
void congestionOccurred()
void packetReceived()
void waitForConnect()
public MessageInputStream getInputStream()
public MessageOutputStream getOutputStream()
public String toString()
toString
in class Object
public SimpleTimer.TimedEvent getConnectionEvent()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |