mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 13:17:36 +03:00
send and track packets with ECN markings
This commit is contained in:
parent
f919473598
commit
5dd6d91c11
21 changed files with 264 additions and 206 deletions
|
@ -1,8 +1,9 @@
|
|||
package quic
|
||||
|
||||
import "github.com/quic-go/quic-go/internal/protocol"
|
||||
|
||||
type sender interface {
|
||||
// Send sends a packet. GSO is only used if gsoSize > 0.
|
||||
Send(p *packetBuffer, gsoSize uint16)
|
||||
Send(p *packetBuffer, gsoSize uint16, ecn protocol.ECN)
|
||||
Run() error
|
||||
WouldBlock() bool
|
||||
Available() <-chan struct{}
|
||||
|
@ -12,6 +13,7 @@ type sender interface {
|
|||
type queueEntry struct {
|
||||
buf *packetBuffer
|
||||
gsoSize uint16
|
||||
ecn protocol.ECN
|
||||
}
|
||||
|
||||
type sendQueue struct {
|
||||
|
@ -39,9 +41,9 @@ func newSendQueue(conn sendConn) sender {
|
|||
// Send sends out a packet. It's guaranteed to not block.
|
||||
// Callers need to make sure that there's actually space in the send queue by calling WouldBlock.
|
||||
// Otherwise Send will panic.
|
||||
func (h *sendQueue) Send(p *packetBuffer, gsoSize uint16) {
|
||||
func (h *sendQueue) Send(p *packetBuffer, gsoSize uint16, ecn protocol.ECN) {
|
||||
select {
|
||||
case h.queue <- queueEntry{buf: p, gsoSize: gsoSize}:
|
||||
case h.queue <- queueEntry{buf: p, gsoSize: gsoSize, ecn: ecn}:
|
||||
// clear available channel if we've reached capacity
|
||||
if len(h.queue) == sendQueueCapacity {
|
||||
select {
|
||||
|
@ -76,7 +78,7 @@ func (h *sendQueue) Run() error {
|
|||
// make sure that all queued packets are actually sent out
|
||||
shouldClose = true
|
||||
case e := <-h.queue:
|
||||
if err := h.conn.Write(e.buf.Data, e.gsoSize); err != nil {
|
||||
if err := h.conn.Write(e.buf.Data, e.gsoSize, e.ecn); err != nil {
|
||||
// This additional check enables:
|
||||
// 1. Checking for "datagram too large" message from the kernel, as such,
|
||||
// 2. Path MTU discovery,and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue