diff options
Diffstat (limited to 'dht/OnionRouter.hs')
-rw-r--r-- | dht/OnionRouter.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/dht/OnionRouter.hs b/dht/OnionRouter.hs index 1c16db6d..bdaf04b2 100644 --- a/dht/OnionRouter.hs +++ b/dht/OnionRouter.hs | |||
@@ -566,8 +566,8 @@ lookupRoute or ni (RouteId rid) = do | |||
566 | mb <- atomically $ readArray (routeMap or) rid | 566 | mb <- atomically $ readArray (routeMap or) rid |
567 | return $ storedRoute <$> mb | 567 | return $ storedRoute <$> mb |
568 | 568 | ||
569 | lookupTimeout :: OnionRouter -> Nonce8 -> OnionDestination r -> STM (OnionDestination RouteId, Int) | 569 | lookupTimeout :: OnionRouter -> OnionDestination r -> STM (OnionDestination RouteId, Int) |
570 | lookupTimeout or n8 (OnionDestination asel ni Nothing) = do | 570 | lookupTimeout or (OnionDestination asel ni Nothing) = do |
571 | let RouteId rid = routeId (nodeId ni) | 571 | let RouteId rid = routeId (nodeId ni) |
572 | mrr <- readArray (routeMap or) rid | 572 | mrr <- readArray (routeMap or) rid |
573 | writeTChan (routeLog or) $ unwords ["ONION lookupTimeout " ,show rid] | 573 | writeTChan (routeLog or) $ unwords ["ONION lookupTimeout " ,show rid] |
@@ -579,7 +579,7 @@ hookQueries :: OnionRouter -> (tid -> Nonce8) | |||
579 | -> TransactionMethods d tid (OnionDestination RouteId) x | 579 | -> TransactionMethods d tid (OnionDestination RouteId) x |
580 | -> TransactionMethods d tid (OnionDestination RouteId) x | 580 | -> TransactionMethods d tid (OnionDestination RouteId) x |
581 | hookQueries or t8 tmethods = TransactionMethods | 581 | hookQueries or t8 tmethods = TransactionMethods |
582 | { dispatchRegister = \getTimeout now mvar od d -> {-# SCC "hookQ.dispatchRegister" #-} do -- :: MVar x -> d -> STM (tid, d) | 582 | { dispatchRegister = \nowPlusExpiry mvar od d -> {-# SCC "hookQ.dispatchRegister" #-} do -- :: MVar x -> d -> STM (tid, d) |
583 | let ni = onionNodeInfo od | 583 | let ni = onionNodeInfo od |
584 | rid@(RouteId ridn) = fromMaybe (routeId (nodeId ni)) $ onionRouteSpec od | 584 | rid@(RouteId ridn) = fromMaybe (routeId (nodeId ni)) $ onionRouteSpec od |
585 | wanted <- {-# SCC "hookQ.wanted" #-} (readArray (pendingRoutes or) ridn) | 585 | wanted <- {-# SCC "hookQ.wanted" #-} (readArray (pendingRoutes or) ridn) |
@@ -588,7 +588,7 @@ hookQueries or t8 tmethods = TransactionMethods | |||
588 | check $ fromMaybe False $ do | 588 | check $ fromMaybe False $ do |
589 | RouteRecord{routeVersion=rv} <- {-# SCC "hookQ.mr" #-} mr | 589 | RouteRecord{routeVersion=rv} <- {-# SCC "hookQ.mr" #-} mr |
590 | return $ wanted <= rv | 590 | return $ wanted <= rv |
591 | ((tid,a,expiry),d') <- dispatchRegister tmethods getTimeout now mvar od d | 591 | (tid,d') <- dispatchRegister tmethods nowPlusExpiry mvar od d |
592 | let Nonce8 w8 = t8 tid | 592 | let Nonce8 w8 = t8 tid |
593 | od' = case od of | 593 | od' = case od of |
594 | OnionDestination {} -> od { onionRouteSpec = Just rid } | 594 | OnionDestination {} -> od { onionRouteSpec = Just rid } |
@@ -600,7 +600,7 @@ hookQueries or t8 tmethods = TransactionMethods | |||
600 | -- check $ W64.size pqs < 20 | 600 | -- check $ W64.size pqs < 20 |
601 | modifyTVar' (pendingQueries or) (W64.insert w8 pq) | 601 | modifyTVar' (pendingQueries or) (W64.insert w8 pq) |
602 | writeTChan (routeLog or) $ "ONION query add " ++ unwords [ show (Just $ pendingVersion pq,w8), ":=", show ni ] | 602 | writeTChan (routeLog or) $ "ONION query add " ++ unwords [ show (Just $ pendingVersion pq,w8), ":=", show ni ] |
603 | return ((tid,a,expiry),d') | 603 | return (tid,d') |
604 | , dispatchResponse = \tid x d -> {-# SCC "hookQ.dispatchResponse" #-} do -- :: tid -> x -> d -> STM (d, IO ()) | 604 | , dispatchResponse = \tid x d -> {-# SCC "hookQ.dispatchResponse" #-} do -- :: tid -> x -> d -> STM (d, IO ()) |
605 | let Nonce8 w8 = t8 tid | 605 | let Nonce8 w8 = t8 tid |
606 | mb <- W64.lookup w8 <$> readTVar (pendingQueries or) | 606 | mb <- W64.lookup w8 <$> readTVar (pendingQueries or) |