mirror of
https://github.com/CPunch/gopenfusion.git
synced 2024-11-14 20:10:06 +00:00
login_test: fix minor memory leak
defer PutBuffer so that the event packet is returned to the pool
This commit is contained in:
parent
2bd61dc571
commit
23170093ee
@ -63,8 +63,9 @@ func sendAndRecv(peer *cnet.Peer, recv chan *cnet.PacketEvent, is *is.I, sID, rI
|
|||||||
|
|
||||||
// receive response
|
// receive response
|
||||||
evnt := <-recv
|
evnt := <-recv
|
||||||
is.Equal(evnt.PktID, rID) // should receive expected type
|
defer protocol.PutBuffer(evnt.Pkt)
|
||||||
|
|
||||||
|
is.Equal(evnt.PktID, rID) // should receive expected type
|
||||||
is.NoErr(protocol.NewPacket(evnt.Pkt).Decode(in)) // packet.Decode() should not return an error
|
is.NoErr(protocol.NewPacket(evnt.Pkt).Decode(in)) // packet.Decode() should not return an error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user