class ConnectionDataReceiver extends Object implements MessageOutputStream.DataReceiver
MessageOutputStream -> ConnectionDataReceiver -> Connection -> PacketQueue -> I2PSession
There's one of these per MessageOutputStream. It stores no state. It sends everything to the Connection unless the Connection is closed,
Constructor and Description |
---|
ConnectionDataReceiver(I2PAppContext ctx,
Connection con) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
destroy() |
PacketLocal |
send(byte[] buf,
int off,
int size)
Send some data through the connection, attaching any appropriate flags
onto the packet.
|
PacketLocal |
send(byte[] buf,
int off,
int size,
boolean forceIncrement)
Called externally from Connection with args (null, 0, 0, true) to send an empty data packet
|
MessageOutputStream.WriteStatus |
writeData(byte[] buf,
int off,
int size)
Send some data through the connection, or if there is no new data, this
may generate a packet with a plain ACK/NACK or CLOSE, or nothing whatsoever
if there's nothing new to send.
|
boolean |
writeInProcess()
This tells the flusher in MessageOutputStream whether to flush.
|
public ConnectionDataReceiver(I2PAppContext ctx, Connection con)
con
- non-nullpublic boolean writeInProcess()
writeInProcess
in interface MessageOutputStream.DataReceiver
public MessageOutputStream.WriteStatus writeData(byte[] buf, int off, int size)
writeData
in interface MessageOutputStream.DataReceiver
buf
- data to be sent - may be nulloff
- offset into the buffer to start writing fromsize
- how many bytes of the buffer to write (may be 0)public PacketLocal send(byte[] buf, int off, int size)
buf
- data to be sent - may be nulloff
- offset into the buffer to start writing fromsize
- how many bytes of the buffer to write (may be 0)public PacketLocal send(byte[] buf, int off, int size, boolean forceIncrement)
buf
- data to be sent - may be nulloff
- offset into the buffer to start writing fromsize
- how many bytes of the buffer to write (may be 0)forceIncrement
- even if the buffer is empty, increment the packetId
so we get an ACK backvoid destroy()