summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dht-client.cabal2
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs20
2 files changed, 14 insertions, 8 deletions
diff --git a/dht-client.cabal b/dht-client.cabal
index 3832eb65..a389a6e3 100644
--- a/dht-client.cabal
+++ b/dht-client.cabal
@@ -300,7 +300,7 @@ executable dhtd
300 if flag(thread-debug) 300 if flag(thread-debug)
301 build-depends: time 301 build-depends: time
302 cpp-options: -DTHREAD_DEBUG -DRENDERFLUSH 302 cpp-options: -DTHREAD_DEBUG -DRENDERFLUSH
303 ghc-options: -rtsopts -fdefer-typed-holes -threaded 303 ghc-options: -g -prof -rtsopts -fdefer-typed-holes -threaded
304 304
305executable testcookie 305executable testcookie
306 buildable: False 306 buildable: False
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index d8ba19eb..82aa8f12 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -623,13 +623,19 @@ freshCryptoSession sessions
623 lossyEsc <- newTVar $ U.listArray (0,255) [0 .. 255] 623 lossyEsc <- newTVar $ U.listArray (0,255) [0 .. 255]
624 losslessEsc <- newTVar $ U.listArray (0,255) [0 .. 255] 624 losslessEsc <- newTVar $ U.listArray (0,255) [0 .. 255]
625 outHooks <- emptySTMRangeMap 625 outHooks <- emptySTMRangeMap
626 mapM_ ($ outHooks) -- TODO: combine into larger ranges for faster lookup 626 let doNothingHook crypto session msg = return (Left "unsupported")
627 [ insertWhereItGoes (A.listArray (2,2) [sendKillHook]) 627 assignHook 2 = (2,sendKillHook)
628 , insertWhereItGoes (A.listArray (16,16) [sendLossless{-Ping-}]) 628 assignHook 16 = (16,sendLossless{-Ping-})
629 , insertWhereItGoes (A.listArray (24,25) [sendOnlineHook,sendLossless{-Offline-}]) 629 assignHook 24 = (24,sendOnlineHook)
630 , insertWhereItGoes (A.listArray (48,51) [sendNickHook,sendStatusMsgHook,sendStatusHook,sendTypingHook]) 630 assignHook 25 = (25,sendLossless{-Offline-})
631 , insertWhereItGoes (A.listArray (63,64) [sendMessageHook, sendMessageHook]) 631 assignHook 48 = (48,sendNickHook)
632 ] 632 assignHook 49 = (49,sendStatusMsgHook)
633 assignHook 50 = (50,sendStatusHook)
634 assignHook 51 = (51,sendTypingHook)
635 assignHook 63 = (63,sendMessageHook)
636 assignHook 64 = (64,sendMessageHook{-ACTION-})
637 assignHook other = (other,doNothingHook)
638 insertArrayAt outHooks 0 (A.array (0,64) (map assignHook [0..64]))
633 return (idmap,lossyEsc,losslessEsc,outHooks) 639 return (idmap,lossyEsc,losslessEsc,outHooks)
634 ncView0 <- newTVar (sessionView sessions) 640 ncView0 <- newTVar (sessionView sessions)
635 pktq <- PQ.new (inboundQueueCapacity sessions) 0 641 pktq <- PQ.new (inboundQueueCapacity sessions) 0