diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/Tox/Crypto/Handlers.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs index c5476371..089a991d 100644 --- a/src/Network/Tox/Crypto/Handlers.hs +++ b/src/Network/Tox/Crypto/Handlers.hs | |||
@@ -28,7 +28,7 @@ data NetCryptoSessionStatus = Unaccepted | Accepted | Confirmed | |||
28 | 28 | ||
29 | 29 | ||
30 | type IOHook addr x = addr -> x -> IO (Maybe (x -> x)) | 30 | type IOHook addr x = addr -> x -> IO (Maybe (x -> x)) |
31 | type NetCryptoHook = IOHook SockAddr CryptoData | 31 | type NetCryptoHook = IOHook NetCryptoSession CryptoData |
32 | 32 | ||
33 | 33 | ||
34 | data NetCryptoSession = NCrypto { ncState :: TVar NetCryptoSessionStatus | 34 | data NetCryptoSession = NCrypto { ncState :: TVar NetCryptoSessionStatus |
@@ -149,7 +149,7 @@ cryptoNetHandler sessions addr (NetCrypto (CryptoPacket nonce16 encrypted)) = do | |||
149 | -- Handle Encrypted Message | 149 | -- Handle Encrypted Message |
150 | case Map.lookup addr sessionsmap of | 150 | case Map.lookup addr sessionsmap of |
151 | Nothing -> return Nothing -- drop packet, we have no session | 151 | Nothing -> return Nothing -- drop packet, we have no session |
152 | Just (NCrypto {ncState, ncHooks,ncSessionSecret,ncTheirSessionPublic,ncTheirBaseNonce}) -> do | 152 | Just session@(NCrypto {ncState, ncHooks,ncSessionSecret,ncTheirSessionPublic,ncTheirBaseNonce}) -> do |
153 | theirBaseNonce <- atomically $ readTVar ncTheirBaseNonce | 153 | theirBaseNonce <- atomically $ readTVar ncTheirBaseNonce |
154 | -- Try to decrypt message | 154 | -- Try to decrypt message |
155 | let diff :: Word16 | 155 | let diff :: Word16 |
@@ -187,7 +187,7 @@ cryptoNetHandler sessions addr (NetCrypto (CryptoPacket nonce16 encrypted)) = do | |||
187 | case (hooks,cd) of | 187 | case (hooks,cd) of |
188 | ([],_) -> return Nothing | 188 | ([],_) -> return Nothing |
189 | (hook:more,cd) -> do | 189 | (hook:more,cd) -> do |
190 | r <- hook addr cd :: IO (Maybe (CryptoData -> CryptoData)) | 190 | r <- hook session cd :: IO (Maybe (CryptoData -> CryptoData)) |
191 | case r of | 191 | case r of |
192 | Just f -> let newcd = f cd | 192 | Just f -> let newcd = f cd |
193 | newtyp = newcd ^. messageType | 193 | newtyp = newcd ^. messageType |