Skip to content

Commit 9524be0

Browse files
committed
[修复]1. 修复链表被提前释放的问题
1 parent f6ef7b1 commit 9524be0

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Runtime/Network/Network/NetworkManager.NetworkChannelBase.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -739,11 +739,10 @@ protected virtual bool ProcessSend()
739739
}
740740

741741

742-
while (PSendPacketPool.First !=null)
742+
while (PSendPacketPool.First != null)
743743
{
744744
var messageObject = PSendPacketPool.First.Value;
745-
PSendPacketPool.RemoveFirst();
746-
bool serializeResult = false;
745+
bool serializeResult;
747746
try
748747
{
749748
serializeResult = ProcessSendMessage(messageObject);
@@ -761,6 +760,10 @@ protected virtual bool ProcessSend()
761760

762761
throw;
763762
}
763+
finally
764+
{
765+
PSendPacketPool.RemoveFirst();
766+
}
764767

765768
if (!serializeResult)
766769
{

Runtime/Network/Network/WebSocket/NetworkManager.WebSocketNetworkChannel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected override bool ProcessSend()
9696
while (PSendPacketPool.First != null)
9797
{
9898
var messageObject = PSendPacketPool.First.Value;
99-
PSendPacketPool.RemoveFirst();
99+
100100

101101
bool serializeResult;
102102
try
@@ -116,6 +116,10 @@ protected override bool ProcessSend()
116116

117117
throw;
118118
}
119+
finally
120+
{
121+
PSendPacketPool.RemoveFirst();
122+
}
119123

120124
if (!serializeResult)
121125
{

0 commit comments

Comments
 (0)