File: send_mode.go

package info (click to toggle)
golang-github-lucas-clemente-quic-go 0.54.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,312 kB
  • sloc: sh: 54; makefile: 7
file content (46 lines) | stat: -rw-r--r-- 1,241 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package ackhandler

import "fmt"

// The SendMode says what kind of packets can be sent.
type SendMode uint8

const (
	// SendNone means that no packets should be sent
	SendNone SendMode = iota
	// SendAck means an ACK-only packet should be sent
	SendAck
	// SendPTOInitial means that an Initial probe packet should be sent
	SendPTOInitial
	// SendPTOHandshake means that a Handshake probe packet should be sent
	SendPTOHandshake
	// SendPTOAppData means that an Application data probe packet should be sent
	SendPTOAppData
	// SendPacingLimited means that the pacer doesn't allow sending of a packet right now,
	// but will do in a little while.
	// The timestamp when sending is allowed again can be obtained via the SentPacketHandler.TimeUntilSend.
	SendPacingLimited
	// SendAny means that any packet should be sent
	SendAny
)

func (s SendMode) String() string {
	switch s {
	case SendNone:
		return "none"
	case SendAck:
		return "ack"
	case SendPTOInitial:
		return "pto (Initial)"
	case SendPTOHandshake:
		return "pto (Handshake)"
	case SendPTOAppData:
		return "pto (Application Data)"
	case SendAny:
		return "any"
	case SendPacingLimited:
		return "pacing limited"
	default:
		return fmt.Sprintf("invalid send mode: %d", s)
	}
}