Documentation ¶
Overview ¶
Package respool contains the Dispatcher's pool of free buffers/packets.
FIXME(scrye): Currently the pools are elastic, but this is not ideal for traffic bursts. Consider converting these to fixed-size lists.
Index ¶
- func GetBuffer() []byte
- func PutBuffer(b []byte)
- type Packet
- func (pkt *Packet) CopyTo(p []byte) int
- func (pkt *Packet) DecodeFromConn(conn net.PacketConn) error
- func (pkt *Packet) DecodeFromReliableConn(conn net.PacketConn) error
- func (pkt *Packet) Dup()
- func (pkt *Packet) Free()
- func (p *Packet) Len() int
- func (pkt *Packet) SendOnConn(conn net.PacketConn, address net.Addr) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Packet ¶
type Packet struct { UnderlayRemote *net.UDPAddr SCION slayers.SCION UDP slayers.UDP SCMP slayers.SCMP // L4 indicates what type is at layer 4. L4 gopacket.LayerType // contains filtered or unexported fields }
Packet describes a SCION packet. Fields might reference each other (including hidden fields), so callers should only write to freshly created packets, and readers should take care never to mutate data.
func (*Packet) CopyTo ¶
CopyTo copies the buffer into the provided bytearray. Returns number of bytes copied.
func (*Packet) DecodeFromConn ¶
func (pkt *Packet) DecodeFromConn(conn net.PacketConn) error
func (*Packet) DecodeFromReliableConn ¶
func (pkt *Packet) DecodeFromReliableConn(conn net.PacketConn) error
func (*Packet) Dup ¶
func (pkt *Packet) Dup()
Dup increases pkt's reference count.
Dup panics if it is called after the packet has been freed (i.e., it's reference count reached 0).
Modifying a packet after the first call to Dup is racy, and callers should use external locking for it.
func (*Packet) Free ¶
func (pkt *Packet) Free()
Free releases a reference to the packet. Free is safe to use from concurrent goroutines.