You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-15 22:56:30 +09:00
CreateIncomingMessage(tp, text) optimized to allocate less memory
This commit is contained in:
@@ -182,8 +182,8 @@ namespace Lidgren.Network
|
||||
return retval;
|
||||
}
|
||||
|
||||
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(text);
|
||||
retval = CreateIncomingMessage(tp, bytes.Length + (bytes.Length > 127 ? 2 : 1));
|
||||
int numBytes = System.Text.Encoding.UTF8.GetByteCount(text);
|
||||
retval = CreateIncomingMessage(tp, numBytes + (numBytes > 127 ? 2 : 1));
|
||||
retval.Write(text);
|
||||
|
||||
return retval;
|
||||
|
||||
Reference in New Issue
Block a user