Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions Bundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
public class Bundle : ObjectPool<Bundle>
{
public MemoryStream stream = new MemoryStream();
public MemoryStream stream = MemoryStream.createObject();
public List<MemoryStream> streamList = new List<MemoryStream>();
public int numMessage = 0;
public int messageLength = 0;
Expand All @@ -23,22 +23,11 @@ public Bundle()
{
}

public void clear()
{
stream = MemoryStream.createObject();
streamList = new List<MemoryStream>();
numMessage = 0;
messageLength = 0;
msgtype = null;
_curMsgStreamIndex = 0;
}

/// <summary>
/// 把自己放回缓冲池
/// </summary>
public void reclaimObject()
{
clear();
{
reclaimObject(this);
}

Expand Down Expand Up @@ -101,8 +90,8 @@ public void send(NetworkInterface networkInterface)
{
for(int i=0; i<streamList.Count; i++)
{
stream = streamList[i];
networkInterface.send(stream);
MemoryStream tempStream = streamList[i];
networkInterface.send(tempStream);
}
}
else
Expand Down