1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

remove unnecessary memory allocation in vmess

This commit is contained in:
v2ray 2016-01-12 13:39:17 +01:00
parent f7a152b871
commit 7881330644

View File

@ -180,7 +180,9 @@ func (this *VMessRequest) ToBytes(timestampGenerator RandomTimestampGenerator, b
idHash := IDHash(this.User.AnyValidID().Bytes())
idHash.Write(timestamp.Bytes())
buffer.Append(idHash.Sum(nil))
hashStart := buffer.Len()
buffer.Slice(0, hashStart+16)
idHash.Sum(buffer.Value[hashStart:hashStart])
encryptionBegin := buffer.Len()