1
0
mirror of https://github.com/fumiama/go-registry.git synced 2026-06-11 20:10:25 +08:00

优化速度

This commit is contained in:
fumiama
2022-02-15 00:38:43 +08:00
parent 0bb4b0bd81
commit e7c05d8bc8
5 changed files with 97 additions and 40 deletions

View File

@@ -18,7 +18,12 @@ func TestCmdPacket(t *testing.T) {
p := NewCmdPacket(CMDGET, []byte("test"), &tp)
conn.Write(p.Encrypt(seq))
seq++
a := string(ack(t, conn, &tp).Decrypt(seq))
ackp := ack(t, conn, &tp)
err = ackp.Decrypt(seq)
if err != nil {
t.Fatal(err)
}
a := string(ackp.data)
t.Log(a)
if a != "null" {
t.Fail()
@@ -27,7 +32,13 @@ func TestCmdPacket(t *testing.T) {
p = NewCmdPacket(CMDSET, []byte("test"), &ts)
conn.Write(p.Encrypt(seq))
seq++
a = string(ack(t, conn, &tp).Decrypt(seq))
ackp = ack(t, conn, &tp)
err = ackp.Decrypt(seq)
if err != nil {
t.Fatal(err)
}
a = string(ackp.data)
t.Log(a)
if a != "data" {
t.Fail()
@@ -36,7 +47,13 @@ func TestCmdPacket(t *testing.T) {
p = NewCmdPacket(CMDDAT, []byte("测试"), &ts)
conn.Write(p.Encrypt(seq))
seq++
a = string(ack(t, conn, &tp).Decrypt(seq))
ackp = ack(t, conn, &tp)
err = ackp.Decrypt(seq)
if err != nil {
t.Fatal(err)
}
a = string(ackp.data)
t.Log(a)
if a != "succ" {
t.Fail()
@@ -45,7 +62,13 @@ func TestCmdPacket(t *testing.T) {
p = NewCmdPacket(CMDGET, []byte("test"), &tp)
conn.Write(p.Encrypt(seq))
seq++
a = string(ack(t, conn, &tp).Decrypt(seq))
ackp = ack(t, conn, &tp)
err = ackp.Decrypt(seq)
if err != nil {
t.Fatal(err)
}
a = string(ackp.data)
t.Log(a)
if a != "测试" {
t.Fail()
@@ -54,7 +77,13 @@ func TestCmdPacket(t *testing.T) {
p = NewCmdPacket(CMDDEL, []byte("test"), &ts)
conn.Write(p.Encrypt(seq))
seq++
a = string(ack(t, conn, &tp).Decrypt(seq))
ackp = ack(t, conn, &tp)
err = ackp.Decrypt(seq)
if err != nil {
t.Fatal(err)
}
a = string(ackp.data)
t.Log(a)
if a != "succ" {
t.Fail()
@@ -63,7 +92,13 @@ func TestCmdPacket(t *testing.T) {
p = NewCmdPacket(CMDGET, []byte("test"), &tp)
conn.Write(p.Encrypt(seq))
seq++
a = string(ack(t, conn, &tp).Decrypt(seq))
ackp = ack(t, conn, &tp)
err = ackp.Decrypt(seq)
if err != nil {
t.Fatal(err)
}
a = string(ackp.data)
t.Log(a)
if a != "null" {
t.Fail()