APIdia Launch Partner
Top Description Methods
jdk.internal.net.http.quic

public Interface PacketEmitter

Imports
java.util.concurrent.Executor, jdk.internal.net.http.common.Deadline, jdk.internal.net.http.quic.frames.AckFrame, jdk.internal.net.http.quic.packets.PacketSpace, .QuicPacket, .QuicPacket.PacketNumberSpace, jdk.internal.net.quic.QuicKeyUnavailableException, .QuicTransportException

This interface is a useful abstraction used to tie PacketSpaceManager and QuicConnectionImpl. The PacketSpaceManager uses functionalities provided by a PacketEmitter when it deems that a packet needs to be retransmitted, or that an acknowledgement is due. It also uses the emitter's timer facility when it needs to register a QuicTimedEvent.

API Note

All these methods are actually implemented by QuicConnectionImpl but the PacketEmitter interface makes it possible to write unit tests against a PacketSpaceManager without involving any QuicConnection instance.

Method Summary

Modifier and TypeMethod and Description
public void
acknowledged(QuicPacket
the acknowledged packet
packet
)

Called when a packet has been acknowledged.

public void
checkAbort(QuicPacket.PacketNumberSpace packetNumberSpace)

Abort the connection if needed, for example if the peer is not responding or max idle time was reached

public long

Returns:

the emitted packet number, or -1L if not applicable or not emitted
emitAckPacket
(PacketSpace
the packet space manager on behalf of which the acknowledgement should be sent.
packetSpaceManager
,
AckFrame
the ACK frame to be sent.
ackFrame
,
boolean
whether a PING frame should be sent.
sendPing
)

Emit a possibly non ACK-eliciting packet containing the given ACK frame.

public Executor

Returns:

an executor to use when offloading loops to another thread is required
executor
()

Returns an executor to use when offloading loops to another thread is required.

public boolean

Returns:

true if this emitter is open for transmitting packets, else returns false
isOpen
()

Returns true if this emitter is open for transmitting packets, else returns false.

public default String
public default void
public default void
reschedule(QuicTimedEvent
the event to reschedule
event
)

Reschedule the given event on the timer

public default void
reschedule(QuicTimedEvent
the event to reschedule
event
,
Deadline deadline)

Reschedule the given event on the timer

public void
retransmit(PacketSpace
the packet space manager on behalf of which the packet is being retransmitted
packetSpaceManager
,
QuicPacket
the unacknowledged packet which should be retransmitted
packet
,
int
the number of previous retransmission of this packet. A value of 0 indicates the first retransmission.
attempts
)

Retransmit the given packet on behalf of the given packet space manager.

public boolean

Returns:

true if a packet was sent, false otherwise
sendData
(QuicPacket.PacketNumberSpace
current packet number space
packetNumberSpace
)

Called when congestion controller allows sending one packet

public QuicTimerQueue

Returns:

the timer queue used by this packet emitter
timer
()

Returns the timer queue used by this packet emitter.

Method Detail

acknowledgedback to summary
public void acknowledged(QuicPacket packet)

Called when a packet has been acknowledged.

Parameters
packet:QuicPacket

the acknowledged packet

checkAbortback to summary
public void checkAbort(QuicPacket.PacketNumberSpace packetNumberSpace)

Abort the connection if needed, for example if the peer is not responding or max idle time was reached

emitAckPacketback to summary
public long emitAckPacket(PacketSpace packetSpaceManager, AckFrame ackFrame, boolean sendPing) throws QuicKeyUnavailableException, QuicTransportException

Emit a possibly non ACK-eliciting packet containing the given ACK frame.

Parameters
packetSpaceManager:PacketSpace

the packet space manager on behalf of which the acknowledgement should be sent.

ackFrame:AckFrame

the ACK frame to be sent.

sendPing:boolean

whether a PING frame should be sent.

Returns:long

the emitted packet number, or -1L if not applicable or not emitted

executorback to summary
public Executor executor()

Returns an executor to use when offloading loops to another thread is required.

Returns:Executor

an executor to use when offloading loops to another thread is required

isOpenback to summary
public boolean isOpen()

Returns true if this emitter is open for transmitting packets, else returns false.

Returns:boolean

true if this emitter is open for transmitting packets, else returns false

logTagback to summary
public default String logTag()
ptoBackoffIncreasedback to summary
public default void ptoBackoffIncreased(PacketSpaceManager space, long backoff)
rescheduleback to summary
public default void reschedule(QuicTimedEvent event)

Reschedule the given event on the timer

Parameters
event:QuicTimedEvent

the event to reschedule

rescheduleback to summary
public default void reschedule(QuicTimedEvent event, Deadline deadline)

Reschedule the given event on the timer

Parameters
event:QuicTimedEvent

the event to reschedule

retransmitback to summary
public void retransmit(PacketSpace packetSpaceManager, QuicPacket packet, int attempts) throws QuicKeyUnavailableException, QuicTransportException

Retransmit the given packet on behalf of the given packet space manager.

Parameters
packetSpaceManager:PacketSpace

the packet space manager on behalf of which the packet is being retransmitted

packet:QuicPacket

the unacknowledged packet which should be retransmitted

attempts:int

the number of previous retransmission of this packet. A value of 0 indicates the first retransmission.

sendDataback to summary
public boolean sendData(QuicPacket.PacketNumberSpace packetNumberSpace) throws QuicKeyUnavailableException, QuicTransportException

Called when congestion controller allows sending one packet

Parameters
packetNumberSpace:QuicPacket.PacketNumberSpace

current packet number space

Returns:boolean

true if a packet was sent, false otherwise

timerback to summary
public QuicTimerQueue timer()

Returns the timer queue used by this packet emitter.

Returns:QuicTimerQueue

the timer queue used by this packet emitter