Skip to content

Commit

Permalink
Fix trades with no remaining notifications not clearing
Browse files Browse the repository at this point in the history
Fixes #70 where trades completed while both parties were online weren't
being cleared and would just pile up.
  • Loading branch information
thomotron committed Dec 5, 2022
1 parent 835e62d commit db0cd25
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Common/Trading/ServerTrading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,12 @@ private void updateTradeStatusPacketHandler(string connectionId, UpdateTradeStat
// Return the other party's items to them and check them off the pending notification list
sendCompleteTradePacket(otherPartyConnectionId, trade.TradeId, true, packet.Uuid, otherPartyItems);
completedTrade.PendingNotification.Remove(otherPartyUuid);

// Prune the trade if there aren't any parties awaiting notification
if (completedTrade.PendingNotification.Count == 0)
{
completedTrades.Remove(trade.TradeId);
}
}
else
{
Expand Down Expand Up @@ -475,6 +481,12 @@ private void updateTradeStatusPacketHandler(string connectionId, UpdateTradeStat
// Give the sender's items to the other party and check them off the pending notification list
sendCompleteTradePacket(otherPartyConnectionId, trade.TradeId, false, packet.Uuid, items);
completedTrade.PendingNotification.Remove(otherPartyUuid);

// Prune the trade if there aren't any parties awaiting notification
if (completedTrade.PendingNotification.Count == 0)
{
completedTrades.Remove(trade.TradeId);
}
}
else
{
Expand Down

0 comments on commit db0cd25

Please sign in to comment.