summaryrefslogtreecommitdiff
path: root/dht/src/Network/Tox
diff options
context:
space:
mode:
Diffstat (limited to 'dht/src/Network/Tox')
-rw-r--r--dht/src/Network/Tox/DHT/Handlers.hs4
-rw-r--r--dht/src/Network/Tox/Onion/Handlers.hs15
-rw-r--r--dht/src/Network/Tox/TCP.hs4
3 files changed, 11 insertions, 12 deletions
diff --git a/dht/src/Network/Tox/DHT/Handlers.hs b/dht/src/Network/Tox/DHT/Handlers.hs
index 1eec93b9..e97cab96 100644
--- a/dht/src/Network/Tox/DHT/Handlers.hs
+++ b/dht/src/Network/Tox/DHT/Handlers.hs
@@ -330,7 +330,7 @@ serializer :: PacketKind
330 -> (Message -> Maybe (Asymm (Nonce8,pong))) 330 -> (Message -> Maybe (Asymm (Nonce8,pong)))
331 -> MethodSerializer TransactionId NodeInfo Message PacketKind ping (Maybe pong) 331 -> MethodSerializer TransactionId NodeInfo Message PacketKind ping (Maybe pong)
332serializer pktkind mkping mkpong = MethodSerializer 332serializer pktkind mkping mkpong = MethodSerializer
333 { methodTimeout = \tid addr -> return (addr, 5000000) 333 { methodTimeout = \addr -> return (addr, 5000000)
334 , method = pktkind 334 , method = pktkind
335 -- wrapQuery :: tid -> addr -> addr -> qry -> x 335 -- wrapQuery :: tid -> addr -> addr -> qry -> x
336 , wrapQuery = \tid src dst ping -> mkping $ wrapAsymm tid src dst (, ping) 336 , wrapQuery = \tid src dst ping -> mkping $ wrapAsymm tid src dst (, ping)
@@ -376,7 +376,7 @@ cookieRequest crypto client localUserKey addr = do
376 nid = id2key $ nodeId addr 376 nid = id2key $ nodeId addr
377 cookieSerializer 377 cookieSerializer
378 = MethodSerializer 378 = MethodSerializer
379 { methodTimeout = \tid addr -> return (addr, 5000000) 379 { methodTimeout = \addr -> return (addr, 5000000)
380 , method = CookieRequestType 380 , method = CookieRequestType
381 , wrapQuery = \tid src dst cr -> DHTCookieRequest $ wrapAsymm tid src dst (, cr) 381 , wrapQuery = \tid src dst cr -> DHTCookieRequest $ wrapAsymm tid src dst (, cr)
382 , unwrapResponse = fmap snd . unCookie 382 , unwrapResponse = fmap snd . unCookie
diff --git a/dht/src/Network/Tox/Onion/Handlers.hs b/dht/src/Network/Tox/Onion/Handlers.hs
index 25713aa1..3ea7395f 100644
--- a/dht/src/Network/Tox/Onion/Handlers.hs
+++ b/dht/src/Network/Tox/Onion/Handlers.hs
@@ -212,7 +212,7 @@ handlers net routing toks keydb AnnounceType
212handlers net _ _ keydb _ = Just $ NoReply Right $ dataToRouteH keydb net 212handlers net _ _ keydb _ = Just $ NoReply Right $ dataToRouteH keydb net
213 213
214 214
215toxidSearch :: (TransactionId -> OnionDestination r -> STM (OnionDestination r, Int)) 215toxidSearch :: (OnionDestination r -> STM (OnionDestination r, Int))
216 -> TransportCrypto 216 -> TransportCrypto
217 -> Client r 217 -> Client r
218 -> Search NodeId (IP, PortNumber) Nonce32 NodeInfo Rendezvous 218 -> Search NodeId (IP, PortNumber) Nonce32 NodeInfo Rendezvous
@@ -224,7 +224,7 @@ toxidSearch getTimeout crypto client = Search
224 , searchK = 6 224 , searchK = 6
225 } 225 }
226 226
227announceSerializer :: (TransactionId -> OnionDestination r -> STM (OnionDestination r, Int)) 227announceSerializer :: (OnionDestination r -> STM (OnionDestination r, Int))
228 -> MethodSerializer 228 -> MethodSerializer
229 TransactionId 229 TransactionId
230 (OnionDestination r) 230 (OnionDestination r)
@@ -276,7 +276,7 @@ unwrapAnnounceResponse alias ni (AnnounceResponse is_stored (SendNodes ns))
276-- started. 276-- started.
277 277
278 278
279sendOnion :: (TransactionId -> OnionDestination r -> STM (OnionDestination r, Int)) 279sendOnion :: (OnionDestination r -> STM (OnionDestination r, Int))
280 -> Client r 280 -> Client r
281 -> AnnounceRequest 281 -> AnnounceRequest
282 -> OnionDestination r 282 -> OnionDestination r
@@ -291,8 +291,7 @@ sendOnion getTimeout client req oaddr unwrap =
291 (return . Just . unwrap (onionNodeInfo oaddr)) 291 (return . Just . unwrap (onionNodeInfo oaddr))
292 $ join mb 292 $ join mb
293 293
294asyncOnion :: (TransactionId 294asyncOnion :: (OnionDestination r -> STM (OnionDestination r, Int))
295 -> OnionDestination r -> STM (OnionDestination r, Int))
296 -> QR.Client 295 -> QR.Client
297 err 296 err
298 PacketKind 297 PacketKind
@@ -316,7 +315,7 @@ asyncOnion getTimeout client req oaddr unwrap go =
316 315
317 316
318-- | Lookup the secret counterpart for a given alias key. 317-- | Lookup the secret counterpart for a given alias key.
319getRendezvous :: (TransactionId -> OnionDestination r -> STM (OnionDestination r, Int)) 318getRendezvous :: (OnionDestination r -> STM (OnionDestination r, Int))
320 -> TransportCrypto 319 -> TransportCrypto
321 -> Client r 320 -> Client r
322 -> NodeId 321 -> NodeId
@@ -334,7 +333,7 @@ getRendezvous getTimeout crypto client nid ni = do
334 (unwrapAnnounceResponse rkey) 333 (unwrapAnnounceResponse rkey)
335 334
336asyncGetRendezvous 335asyncGetRendezvous
337 :: (TransactionId -> OnionDestination r -> STM (OnionDestination r, Int)) 336 :: (OnionDestination r -> STM (OnionDestination r, Int))
338 -> TransportCrypto 337 -> TransportCrypto
339 -> Client r 338 -> Client r
340 -> NodeId 339 -> NodeId
@@ -353,7 +352,7 @@ asyncGetRendezvous getTimeout crypto client nid ni go = do
353 (unwrapAnnounceResponse rkey) 352 (unwrapAnnounceResponse rkey)
354 go 353 go
355 354
356putRendezvous :: (TransactionId -> OnionDestination r -> STM (OnionDestination r, Int)) 355putRendezvous :: (OnionDestination r -> STM (OnionDestination r, Int))
357 -> TransportCrypto 356 -> TransportCrypto
358 -> Client r 357 -> Client r
359 -> PublicKey 358 -> PublicKey
diff --git a/dht/src/Network/Tox/TCP.hs b/dht/src/Network/Tox/TCP.hs
index d0d67f25..e80a22d1 100644
--- a/dht/src/Network/Tox/TCP.hs
+++ b/dht/src/Network/Tox/TCP.hs
@@ -229,7 +229,7 @@ getUDPNodes' tcp seeking dst0 = do
229 AnnounceRequest 229 AnnounceRequest
230 (Either String AnnounceResponse) 230 (Either String AnnounceResponse)
231 meth = MethodSerializer 231 meth = MethodSerializer
232 { methodTimeout = \tid addr -> return (addr,12000000) -- 12 second timeout 232 { methodTimeout = \addr -> return (addr,12000000) -- 12 second timeout
233 , method = OnionPacketID -- meth 233 , method = OnionPacketID -- meth
234 , wrapQuery = \n8 src gateway x -> (,) True $ 234 , wrapQuery = \n8 src gateway x -> (,) True $
235 OnionPacket n24 $ Addressed (UDP.nodeAddr dst) 235 OnionPacket n24 $ Addressed (UDP.nodeAddr dst)
@@ -269,7 +269,7 @@ tcpPing client dst = do
269 where meth = MethodSerializer 269 where meth = MethodSerializer
270 { wrapQuery = \n8 src dst () -> (True,RelayPing n8) 270 { wrapQuery = \n8 src dst () -> (True,RelayPing n8)
271 , unwrapResponse = \_ -> () 271 , unwrapResponse = \_ -> ()
272 , methodTimeout = \n8 dst -> return (dst,5000000) 272 , methodTimeout = \dst -> return (dst,5000000)
273 , method = PingPacket 273 , method = PingPacket
274 } 274 }
275 275