diff options
-rw-r--r-- | OnionRouter.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/OnionRouter.hs b/OnionRouter.hs index 2391e13c..e3c32fbe 100644 --- a/OnionRouter.hs +++ b/OnionRouter.hs | |||
@@ -388,19 +388,19 @@ hookQueries :: OnionRouter -> (tid -> Nonce8) | |||
388 | -> TransactionMethods d tid (OnionDestination RouteId) x | 388 | -> TransactionMethods d tid (OnionDestination RouteId) x |
389 | hookQueries or t8 tmethods = TransactionMethods | 389 | hookQueries or t8 tmethods = TransactionMethods |
390 | { dispatchRegister = \mvar od d -> {-# SCC "hookQ.dispatchRegister" #-} do -- :: MVar x -> d -> STM (tid, d) | 390 | { dispatchRegister = \mvar od d -> {-# SCC "hookQ.dispatchRegister" #-} do -- :: MVar x -> d -> STM (tid, d) |
391 | (tid,d') <- dispatchRegister tmethods mvar od d | 391 | let ni = onionNodeInfo od |
392 | let Nonce8 w8 = t8 tid | ||
393 | ni = onionNodeInfo od | ||
394 | rid@(RouteId ridn) = fromMaybe (routeId (nodeId ni)) $ onionRouteSpec od | 392 | rid@(RouteId ridn) = fromMaybe (routeId (nodeId ni)) $ onionRouteSpec od |
395 | od' = case od of | ||
396 | OnionDestination {} -> od { onionRouteSpec = Just rid } | ||
397 | OnionToOwner a b -> OnionToOwner a b -- Type cast. | ||
398 | wanted <- {-# SCC "hookQ.wanted" #-} (readTVar (pendingRoutes or IntMap.! ridn)) | 393 | wanted <- {-# SCC "hookQ.wanted" #-} (readTVar (pendingRoutes or IntMap.! ridn)) |
399 | mr <- {-# SCC "hookQ.mr_action" #-} (readArray (routeMap or) ridn) | 394 | mr <- {-# SCC "hookQ.mr_action" #-} (readArray (routeMap or) ridn) |
400 | -- Block query until a route is ready. | 395 | -- Block query until a route is ready. |
401 | check $ fromMaybe False $ do | 396 | check $ fromMaybe False $ do |
402 | RouteRecord{routeVersion=rv} <- {-# SCC "hookQ.mr" #-} mr | 397 | RouteRecord{routeVersion=rv} <- {-# SCC "hookQ.mr" #-} mr |
403 | return $ wanted <= rv | 398 | return $ wanted <= rv |
399 | (tid,d') <- dispatchRegister tmethods mvar od d | ||
400 | let Nonce8 w8 = t8 tid | ||
401 | od' = case od of | ||
402 | OnionDestination {} -> od { onionRouteSpec = Just rid } | ||
403 | OnionToOwner a b -> OnionToOwner a b -- Type cast. | ||
404 | let pq = PendingQuery { pendingDestination = od' | 404 | let pq = PendingQuery { pendingDestination = od' |
405 | , pendingVersion = maybe 0 routeVersion mr | 405 | , pendingVersion = maybe 0 routeVersion mr |
406 | } | 406 | } |