test
This commit is contained in:
parent
f6c99c60c3
commit
856d7c4b4e
9
main.go
9
main.go
@ -20,16 +20,17 @@ func main() {
|
||||
_, err = conn.Write(p.Bytes())
|
||||
failError(err, "conn.Write")
|
||||
logInfoDebug("Authentication sent (%v)", p.Bytes())
|
||||
r := bufio.NewReader(conn)
|
||||
|
||||
for {
|
||||
p := Packet{}
|
||||
b, err := conn.ReadByte()
|
||||
b, err := r.ReadByte()
|
||||
logErrorDebug(err, "conn.ReadByte")
|
||||
p.PLength = uint8(b) << 8
|
||||
b, err = conn.ReadByte()
|
||||
b, err = r.ReadByte()
|
||||
logErrorDebug(err, "conn.ReadByte")
|
||||
p.PLength += uint8(b)
|
||||
b, err = conn.ReadByte()
|
||||
b, err = r.ReadByte()
|
||||
logErrorDebug(err, "conn.ReadByte")
|
||||
p.PType = uint8(b)
|
||||
if p.PLength <= 3 {
|
||||
@ -39,7 +40,7 @@ func main() {
|
||||
d := make([]byte, p.PLength-3)
|
||||
|
||||
for {
|
||||
_, err := conn.Read(d[len(d):])
|
||||
_, err := r.Read(d[len(d):])
|
||||
logErrorDebug(err, "conn.Read")
|
||||
if len(d) == int(p.PLength-3) {
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user