Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PlayPacketQueue ¶
type PlayPacketQueue struct {
// contains filtered or unexported fields
}
PlayPacketQueue is a packet queue for the PLAY state. It holds packets that are not registered in the CONFIG state and releases them when ReleaseQueue is called. Much of the Gate API (i.e. chat messages) utilize PLAY packets, however the client is incapable of receiving these packets during the CONFIG state. Certain events such as the ServerPreConnectEvent may be called during this time, and we need to ensure that any API that uses these packets will work as expected. This handler will queue up any packets that are sent to the client during this time, and send them once the client has (re)entered the PLAY state.
func NewPlayPacketQueue ¶
func NewPlayPacketQueue(version proto.Protocol, direction proto.Direction) *PlayPacketQueue
NewPlayPacketQueue creates a new PlayPacketQueue with the given protocol version, and direction.
func (*PlayPacketQueue) Queue ¶
func (h *PlayPacketQueue) Queue(packet proto.Packet) bool
Queue returns true if the packet was queued. If the packet is not registered in the CONFIG state, it will be queued. Otherwise, it will not be queued and false will be returned.
func (*PlayPacketQueue) ReleaseQueue ¶
func (h *PlayPacketQueue) ReleaseQueue( buffer func(proto.Packet) error, flush func() error, ) error
ReleaseQueue releases all packets in the queue to the sink packet writer. It iterates over the queue, buffering each packet and flushing the sink.