summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2018-05-29 19:04:20 +0000
committerJames Crayne <jim.crayne@gmail.com>2018-05-29 19:04:20 +0000
commitaa0fd249b8a9e0d5f627c6f616f30dd231081419 (patch)
tree8327a9999fee93e3910fd31439e7f19d8b394410
parent7c3169c7c940cae50c56b62afe4dcd0579626c99 (diff)
initialize ncOutgoingIdMap
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs7
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 -
748sendCrypto crypto session updateLocal cm = do 751sendCrypto 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