Skip to content

Commit

Permalink
Optimize dictionary access
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon committed Mar 30, 2020
1 parent 007ff3e commit def1ebf
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/RpcServer/RelayActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ protected override void OnReceive(object message)
switch (message)
{
case IInventory inventory:
this.senders.Add(inventory.Hash, Sender);
neoSystem.Blockchain.Tell(inventory);
break;
{
senders.Add(inventory.Hash, Sender);
neoSystem.Blockchain.Tell(inventory);
break;
}
case RelayResult reason:
UInt256 hash = reason.Inventory.Hash;
if (senders.ContainsKey(reason.Inventory.Hash))
{
senders[hash].Tell(reason);
senders.Remove(hash);
if (senders.Remove(reason.Inventory.Hash, out var actor))
{
actor.Tell(reason);
}
break;
}
break;
}
}

Expand Down

0 comments on commit def1ebf

Please sign in to comment.