summaryrefslogtreecommitdiff
path: root/src/Network/Tox/Onion/Handlers.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-10-21 22:01:16 -0400
committerjoe <joe@jerkface.net>2017-10-21 22:01:16 -0400
commit7ab09c43f0bb6f8f42c0156644869dfe78aa0b89 (patch)
tree760fb412fe55e7de11e5011a1f54f1f4ee5afefb /src/Network/Tox/Onion/Handlers.hs
parentcbdcc6500d6bda9948268312fc0bfb17955e53c5 (diff)
Renamed Assym -> Asymm (short for asymmetric).
Diffstat (limited to 'src/Network/Tox/Onion/Handlers.hs')
-rw-r--r--src/Network/Tox/Onion/Handlers.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Network/Tox/Onion/Handlers.hs b/src/Network/Tox/Onion/Handlers.hs
index 103c216b..23673273 100644
--- a/src/Network/Tox/Onion/Handlers.hs
+++ b/src/Network/Tox/Onion/Handlers.hs
@@ -46,8 +46,8 @@ classify :: Message -> MessageClass String PacketKind TransactionId
46classify msg = go msg 46classify msg = go msg
47 where 47 where
48 go (OnionAnnounce announce) = IsQuery AnnounceType 48 go (OnionAnnounce announce) = IsQuery AnnounceType
49 $ TransactionId (snd $ runIdentity $ assymData announce) 49 $ TransactionId (snd $ runIdentity $ asymmData announce)
50 (assymNonce announce) 50 (asymmNonce announce)
51 go (OnionAnnounceResponse n8 n24 resp) = IsResponse (TransactionId n8 n24) 51 go (OnionAnnounceResponse n8 n24 resp) = IsResponse (TransactionId n8 n24)
52 go (OnionToRoute {}) = IsQuery DataRequestType (TransactionId (Nonce8 0) (Nonce24 zeros24)) 52 go (OnionToRoute {}) = IsQuery DataRequestType (TransactionId (Nonce8 0) (Nonce24 zeros24))
53 go (OnionToRouteResponse {}) = IsResponse (TransactionId (Nonce8 0) (Nonce24 zeros24)) 53 go (OnionToRouteResponse {}) = IsResponse (TransactionId (Nonce8 0) (Nonce24 zeros24))
@@ -116,7 +116,7 @@ dataToRouteH ::
116 -> addr 116 -> addr
117 -> OnionMessage f 117 -> OnionMessage f
118 -> IO () 118 -> IO ()
119dataToRouteH keydb udp _ (OnionToRoute pub assym) = do 119dataToRouteH keydb udp _ (OnionToRoute pub asymm) = do
120 let k = key2id pub 120 let k = key2id pub
121 mb <- atomically $ do 121 mb <- atomically $ do
122 ks <- readTVar keydb 122 ks <- readTVar keydb
@@ -125,7 +125,7 @@ dataToRouteH keydb udp _ (OnionToRoute pub assym) = do
125 return rpath 125 return rpath
126 forM_ mb $ \rpath -> do 126 forM_ mb $ \rpath -> do
127 -- forward 127 -- forward
128 sendMessage udp (toOnionDestination rpath) $ OnionToRouteResponse assym 128 sendMessage udp (toOnionDestination rpath) $ OnionToRouteResponse asymm
129 hPutStrLn stderr $ "Forwarding data-to-route -->"++show k 129 hPutStrLn stderr $ "Forwarding data-to-route -->"++show k
130 130
131type NodeDistance = NodeId 131type NodeDistance = NodeId
@@ -150,7 +150,7 @@ insertKey tm pub toxpath d keydb = AnnouncedKeys
150 } 150 }
151 151
152areq :: Message -> Either String AnnounceRequest 152areq :: Message -> Either String AnnounceRequest
153areq (OnionAnnounce assym) = Right $ fst $ runIdentity $ assymData assym 153areq (OnionAnnounce asymm) = Right $ fst $ runIdentity $ asymmData asymm
154areq _ = Left "Unexpected non-announce OnionMessage" 154areq _ = Left "Unexpected non-announce OnionMessage"
155 155
156handlers :: Transport err (OnionDestination r) Message 156handlers :: Transport err (OnionDestination r) Message
@@ -189,13 +189,13 @@ announceSerializer getTimeout = MethodSerializer
189 , method = AnnounceType 189 , method = AnnounceType
190 , wrapQuery = \(TransactionId n8 n24) src dst req -> 190 , wrapQuery = \(TransactionId n8 n24) src dst req ->
191 -- :: tid -> addr -> addr -> a -> OnionMessage Identity 191 -- :: tid -> addr -> addr -> a -> OnionMessage Identity
192 OnionAnnounce $ Assym 192 OnionAnnounce $ Asymm
193 { -- The public key is our real long term public key if we want to 193 { -- The public key is our real long term public key if we want to
194 -- announce ourselves, a temporary one if we are searching for 194 -- announce ourselves, a temporary one if we are searching for
195 -- friends. 195 -- friends.
196 senderKey = onionKey src 196 senderKey = onionKey src
197 , assymNonce = n24 197 , asymmNonce = n24
198 , assymData = Identity (req, n8) 198 , asymmData = Identity (req, n8)
199 } 199 }
200 , unwrapResponse = \case -- :: OnionMessage Identity -> b 200 , unwrapResponse = \case -- :: OnionMessage Identity -> b
201 OnionAnnounceResponse _ _ resp -> Just $ runIdentity resp 201 OnionAnnounceResponse _ _ resp -> Just $ runIdentity resp