1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-16 15:16:33 +09:00

Added recycling to a few samples that lacked it

This commit is contained in:
lidgren
2013-05-08 13:26:17 +00:00
parent 4b872d3454
commit 4dffa9dc9b
7 changed files with 8 additions and 2 deletions

View File

@@ -75,6 +75,7 @@ namespace ChatClient
Output("Unhandled type: " + im.MessageType + " " + im.LengthBytes + " bytes"); Output("Unhandled type: " + im.MessageType + " " + im.LengthBytes + " bytes");
break; break;
} }
s_client.Recycle(im);
} }
} }

View File

@@ -87,6 +87,7 @@ namespace ChatServer
Output("Unhandled type: " + im.MessageType + " " + im.LengthBytes + " bytes " + im.DeliveryMethod + "|" + im.SequenceChannel); Output("Unhandled type: " + im.MessageType + " " + im.LengthBytes + " bytes " + im.DeliveryMethod + "|" + im.SequenceChannel);
break; break;
} }
s_server.Recycle(im);
} }
Thread.Sleep(1); Thread.Sleep(1);
} }

View File

@@ -86,6 +86,7 @@ namespace FileStreamClient
} }
break; break;
} }
s_client.Recycle(inc);
} }
} }
} }

View File

@@ -65,6 +65,7 @@ namespace FileStreamServer
} }
break; break;
} }
s_server.Recycle(inc);
} }
// stream to all connections // stream to all connections

View File

@@ -31,8 +31,8 @@ namespace FileStreamServer
if (freeWindowSlots > 0) if (freeWindowSlots > 0)
{ {
// send another part of the file! // send another part of the file!
int remaining = (int)(m_inputStream.Length - m_sentOffset); long remaining = m_inputStream.Length - m_sentOffset;
int sendBytes = (remaining > m_chunkLen ? m_chunkLen : remaining); int sendBytes = (remaining > m_chunkLen ? m_chunkLen : (int)remaining);
// just assume we can read the whole thing in one Read() // just assume we can read the whole thing in one Read()
m_inputStream.Read(m_tmpBuffer, 0, sendBytes); m_inputStream.Read(m_tmpBuffer, 0, sendBytes);

View File

@@ -74,6 +74,7 @@ namespace SpeedTestClient
Output("Unhandled type: " + im.MessageType); Output("Unhandled type: " + im.MessageType);
break; break;
} }
s_client.Recycle(im);
} }
float now = (float)NetTime.Now; float now = (float)NetTime.Now;

View File

@@ -52,6 +52,7 @@ namespace UnconnectedSample
Peer.Recycle(im); Peer.Recycle(im);
break; break;
} }
Peer.Recycle(im);
} }
System.Threading.Thread.Sleep(1); System.Threading.Thread.Sleep(1);