summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Core/PeerId.hs
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-12-29 08:06:09 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2013-12-29 08:06:09 +0400
commita7aa11359b5964bbd984b5e3aa66cf78664035b1 (patch)
tree50de4a5f72157e2e69a205ebff497fb0e1787f22 /src/Network/BitTorrent/Core/PeerId.hs
parent4a46766d5fb0882151e80f9137983a8c2dfb7869 (diff)
Keep routing table in MVar.
Since table updates is not atomic operations and may perform IO we should be able to gain /exclusive/ access to the table. Consider insertNode function: 1) Thread A read table_1; 2) Thread B read table_1; 3) Thread B ping node Z and it does not respond and get removed; 4) Thread B remove node Z from table_1 and get table_2; 5) Thread B put table_2; 6) Thread A insert a new node and get table_3; 4) Thread A put table_3; The problem is that final table_3 do have the removed node. At the moment, exclusive access solves this problem.
Diffstat (limited to 'src/Network/BitTorrent/Core/PeerId.hs')
0 files changed, 0 insertions, 0 deletions