Files
core/udt/packet/packet_congestion.go
Kleissner 75e3d9a42e Initial UDT implementation for file transfer.
New function RequestFileTransferUDT to download files from other peers.
2021-10-24 04:26:30 +02:00

24 lines
661 B
Go

package packet
// Structure of packets and functions for writing/reading them
// CongestionPacket is a (deprecated) UDT packet notifying the peer of increased congestion
type CongestionPacket struct {
ctrlHeader
}
// WriteTo writes this packet to the provided buffer, returning the length of the packet
func (p *CongestionPacket) WriteTo(buf []byte) (uint, error) {
return p.writeHdrTo(buf, ptCongestion, 0)
}
func (p *CongestionPacket) readFrom(data []byte) (err error) {
_, err = p.readHdrFrom(data)
return
}
// PacketType returns the packetType associated with this packet
func (p *CongestionPacket) PacketType() PacketType {
return ptCongestion
}