diff options
Diffstat (limited to 'src/Network/Tox/Crypto/Handlers.hs')
-rw-r--r-- | src/Network/Tox/Crypto/Handlers.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs index 364e233e..ff00bd61 100644 --- a/src/Network/Tox/Crypto/Handlers.hs +++ b/src/Network/Tox/Crypto/Handlers.hs | |||
@@ -438,7 +438,10 @@ freshCryptoSession sessions | |||
438 | ncUnrecognizedHook0 <- atomically $ newTVar (defaultUnrecognizedHook sessions) | 438 | ncUnrecognizedHook0 <- atomically $ newTVar (defaultUnrecognizedHook sessions) |
439 | ncIncomingTypeArray0 <- atomically $ newTVar (msgTypeArray sessions) | 439 | ncIncomingTypeArray0 <- atomically $ newTVar (msgTypeArray sessions) |
440 | let idMap = foldl (\mp (x,y) -> W64.insert x y mp) W64.empty (zip [0..255] [0..255]) | 440 | let idMap = foldl (\mp (x,y) -> W64.insert x y mp) W64.empty (zip [0..255] [0..255]) |
441 | ncOutgoingIdMap0 <- atomically $ emptySTMRangeMap -- atomically $ newTVar idMap | 441 | ncOutgoingIdMap0 <- atomically $ do |
442 | idmap <- emptySTMRangeMap | ||
443 | insertArrayAt idmap 0 (A.listArray (0,255) [0 .. 255]) | ||
444 | return idmap | ||
442 | ncView0 <- atomically $ newTVar (sessionView sessions) | 445 | ncView0 <- atomically $ newTVar (sessionView sessions) |
443 | pktq <- atomically $ PQ.new (inboundQueueCapacity sessions) 0 | 446 | pktq <- atomically $ PQ.new (inboundQueueCapacity sessions) 0 |
444 | bufstart <- atomically $ newTVar 0 | 447 | bufstart <- atomically $ newTVar 0 |
@@ -748,7 +751,9 @@ sendCrypto :: TransportCrypto -> NetCryptoSession -> (STM ()) -> CryptoMessage - | |||
748 | sendCrypto crypto session updateLocal cm = do | 751 | sendCrypto crypto session updateLocal cm = do |
749 | let outq = ncOutgoingQueue session | 752 | let outq = ncOutgoingQueue session |
750 | -- XXX: potential race? if shared secret comes out of sync with cache? | 753 | -- XXX: potential race? if shared secret comes out of sync with cache? |
754 | dput XNetCrypto "sendCrypto: enter " | ||
751 | getOutGoingParam <- PQ.readyOutGoing outq | 755 | getOutGoingParam <- PQ.readyOutGoing outq |
756 | dput XNetCrypto "sendCrypto: got the io extra stuff" | ||
752 | atomically $ do | 757 | atomically $ do |
753 | result <- PQ.tryAppendQueueOutgoing getOutGoingParam outq cm | 758 | result <- PQ.tryAppendQueueOutgoing getOutGoingParam outq cm |
754 | case result of | 759 | case result of |