-
Notifications
You must be signed in to change notification settings - Fork 19
/
packet_msgdropreq.go
48 lines (41 loc) · 987 Bytes
/
packet_msgdropreq.go
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
47
48
package udt
// Structure of packets and functions for writing/reading them
import (
"io"
)
type msgDropReqPacket struct {
h header
msgId uint32 // Message ID
firstSeq uint32 // First sequence number in the message
lastSeq uint32 // Last sequence number in the message
}
func (p *msgDropReqPacket) socketId() (sockId uint32) {
return p.h.dstSockId
}
func (p *msgDropReqPacket) sendTime() (ts uint32) {
return p.h.ts
}
func (p *msgDropReqPacket) writeTo(w io.Writer) (err error) {
if err := p.h.writeTo(w, msg_drop_req, p.msgId); err != nil {
return err
}
if err := writeBinary(w, p.firstSeq); err != nil {
return err
}
if err := writeBinary(w, p.lastSeq); err != nil {
return err
}
return
}
func (p *msgDropReqPacket) readFrom(r io.Reader) (err error) {
if p.msgId, err = p.h.readFrom(r); err != nil {
return
}
if err = readBinary(r, &p.firstSeq); err != nil {
return
}
if err = readBinary(r, &p.lastSeq); err != nil {
return
}
return
}