Skip to content

Commit

Permalink
Recycle outgoing ping and mtu messages
Browse files Browse the repository at this point in the history
  • Loading branch information
lidgren committed Nov 5, 2014
1 parent 6533e27 commit 740cc2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Lidgren.Network/NetConnection.Latency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ internal void SendPing()
m_peer.SendPacket(len, m_remoteEndPoint, 1, out connectionReset);

m_statistics.PacketSent(len, 1);
m_peer.Recycle(om);
}

internal void SendPong(int pingNumber)
Expand All @@ -91,6 +92,7 @@ internal void SendPong(int pingNumber)
m_peer.SendPacket(len, m_remoteEndPoint, 1, out connectionReset);

m_statistics.PacketSent(len, 1);
m_peer.Recycle(om);
}

internal void ReceivedPong(float now, int pongNumber, float remoteSendTime)
Expand Down
2 changes: 2 additions & 0 deletions Lidgren.Network/NetConnection.MTU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ private void SendExpandMTU(double now, int size)
m_lastSentMTUAttemptTime = now;

m_statistics.PacketSent(len, 1);
m_peer.Recycle(om);
}

private void FinalizeMTU(int size)
Expand All @@ -154,6 +155,7 @@ private void SendMTUSuccess(int size)
int len = om.Encode(m_peer.m_sendBuffer, 0, 0);
bool connectionReset;
m_peer.SendPacket(len, m_remoteEndPoint, 1, out connectionReset);
m_peer.Recycle(om);

//m_peer.LogDebug("Received MTU expand request for " + size + " bytes");

Expand Down

0 comments on commit 740cc2e

Please sign in to comment.