summaryrefslogtreecommitdiff
path: root/dht/src
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2020-01-03 23:08:58 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-07 13:24:59 -0500
commitb411ab66ceee7386e4829e2337c735a08fb3d54d (patch)
treeb4eaa02216188f627371154ff4e1b0a26be29623 /dht/src
parentb2a3bbf92c67b87e491e3d8187577110e7de57fb (diff)
Support for async queries.
Diffstat (limited to 'dht/src')
-rw-r--r--dht/src/Network/Tox/Onion/Routes.hs2
-rw-r--r--dht/src/Network/Tox/TCP.hs6
2 files changed, 4 insertions, 4 deletions
diff --git a/dht/src/Network/Tox/Onion/Routes.hs b/dht/src/Network/Tox/Onion/Routes.hs
index 7c11227a..9ce4e316 100644
--- a/dht/src/Network/Tox/Onion/Routes.hs
+++ b/dht/src/Network/Tox/Onion/Routes.hs
@@ -171,7 +171,7 @@ newOnionRouter crypto perror tcp_enabled = do
171 ((tbl,(tcptbl,tcpcons,relaynet,onionnet)),tcp) <- do 171 ((tbl,(tcptbl,tcpcons,relaynet,onionnet)),tcp) <- do
172 (tcptbl, client) <- TCP.newClient crypto 172 (tcptbl, client) <- TCP.newClient crypto
173 id 173 id
174 (. (Success . (,) False)) 174 (\x -> \qid -> x qid . Success . (,) False)
175 (lookupSender' pq rlog) 175 (lookupSender' pq rlog)
176 (\_ (RouteId rid) -> atomically $ fmap storedRoute <$> readArray rm rid) 176 (\_ (RouteId rid) -> atomically $ fmap storedRoute <$> readArray rm rid)
177 177
diff --git a/dht/src/Network/Tox/TCP.hs b/dht/src/Network/Tox/TCP.hs
index 0850ce51..385da35b 100644
--- a/dht/src/Network/Tox/TCP.hs
+++ b/dht/src/Network/Tox/TCP.hs
@@ -319,8 +319,8 @@ type RelayCache = TCPCache (SessionProtocol (SessionData,RelayPacket) RelayPacke
319-- defaults are 'id' and 'tryPutMVar'. The resulting customized table state 319-- defaults are 'id' and 'tryPutMVar'. The resulting customized table state
320-- will be returned to the caller along with the new client. 320-- will be returned to the caller along with the new client.
321newClient :: TransportCrypto 321newClient :: TransportCrypto
322 -> ((QR.Result (Bool,RelayPacket) -> IO ()) -> a) -- ^ store mvar for relay query 322 -> ((Nonce8 -> QR.Result (Bool,RelayPacket) -> IO ()) -> a) -- ^ store mvar for relay query
323 -> (a -> RelayPacket -> IO void) -- ^ load mvar for relay query 323 -> (a -> Nonce8 -> RelayPacket -> IO void) -- ^ load mvar for relay query
324 -> (SockAddr -> Nonce8 -> IO (Maybe (OnionDestination RouteId))) -- ^ lookup sender of onion query 324 -> (SockAddr -> Nonce8 -> IO (Maybe (OnionDestination RouteId))) -- ^ lookup sender of onion query
325 -> (UDP.NodeInfo -> RouteId -> IO (Maybe OnionRoute)) -- ^ lookup OnionRoute by id 325 -> (UDP.NodeInfo -> RouteId -> IO (Maybe OnionRoute)) -- ^ lookup OnionRoute by id
326 -> IO ( ( TVar (ChaChaDRG, Data.Word64Map.Word64Map a) 326 -> IO ( ( TVar (ChaChaDRG, Data.Word64Map.Word64Map a)
@@ -361,7 +361,7 @@ newClient crypto store load lookupSender getRoute = do
361 } 361 }
362 , tableMethods = transactionMethods' 362 , tableMethods = transactionMethods'
363 store 363 store
364 (\x -> mapM_ (load x . snd)) 364 (\qid x -> mapM_ (load qid x . snd))
365 (contramap (\(Nonce8 w64) -> w64) w64MapMethods) 365 (contramap (\(Nonce8 w64) -> w64) w64MapMethods)
366 $ first (either error Nonce8 . decode) . randomBytesGenerate 8 366 $ first (either error Nonce8 . decode) . randomBytesGenerate 8
367 } 367 }