summaryrefslogtreecommitdiff
path: root/src/Network/Tox/Crypto/Handlers.hs
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2017-11-23 13:45:52 +0000
committerJames Crayne <jim.crayne@gmail.com>2017-11-23 13:46:03 +0000
commit3e33a6204b5fc55475bc0bd03602fd8a4930ac7c (patch)
tree0ba7d0e39bb4978dc0dd4c2920bbe9e7008816d4 /src/Network/Tox/Crypto/Handlers.hs
parent2de737b059753ced54b21c60b4c4c41bac58e398 (diff)
remove obsolete receiveCrypto function
Diffstat (limited to 'src/Network/Tox/Crypto/Handlers.hs')
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs12
1 files changed, 0 insertions, 12 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index ef7afe98..59e78213 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -280,18 +280,6 @@ ncToWire getState seqno bufend pktno msg = do
280 pkt = CryptoPacket { pktNonce = nonce24ToWord16 n24, pktData = encrypted } 280 pkt = CryptoPacket { pktNonce = nonce24ToWord16 n24, pktData = encrypted }
281 in return (Just (pkt, pktno+1)) 281 in return (Just (pkt, pktno+1))
282 282
283-- | Blocks until a packet is available, or the session is terminated.
284receiveCrypto :: NetCryptoSession -> IO (Maybe CryptoMessage)
285receiveCrypto nc@NCrypto { ncState, ncPacketQueue } = do
286 cd <- atomically $ do
287 st <- readTVar ncState
288 case st of
289 Accepted -> Just <$> PQ.dequeue ncPacketQueue
290 Confirmed -> Just <$> PQ.dequeue ncPacketQueue
291 _ -> pure Nothing
292 forM_ cd $ runCryptoHook nc -- TODO: Is this useful?
293 return $ bufferData <$> cd
294
295-- | called when we recieve a crypto handshake with valid cookie 283-- | called when we recieve a crypto handshake with valid cookie
296-- TODO set priority on contact addr to 0 if it is older than ForgetPeriod, 284-- TODO set priority on contact addr to 0 if it is older than ForgetPeriod,
297-- then increment it regardless. (Keep addr in MinMaxPSQ in Roster.Contact) 285-- then increment it regardless. (Keep addr in MinMaxPSQ in Roster.Contact)