diff options
Diffstat (limited to 'src/Network/BitTorrent/DHT')
-rw-r--r-- | src/Network/BitTorrent/DHT/Query.hs | 2 | ||||
-rw-r--r-- | src/Network/BitTorrent/DHT/Session.hs | 10 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/Network/BitTorrent/DHT/Query.hs b/src/Network/BitTorrent/DHT/Query.hs index abe1ef5f..627bc096 100644 --- a/src/Network/BitTorrent/DHT/Query.hs +++ b/src/Network/BitTorrent/DHT/Query.hs | |||
@@ -137,5 +137,5 @@ publish ih p = do | |||
137 | 137 | ||
138 | republish :: DHT ip ThreadId | 138 | republish :: DHT ip ThreadId |
139 | republish = fork $ do | 139 | republish = fork $ do |
140 | i <- askOption optReannounce | 140 | i <- asks (optReannounce . options) |
141 | error "DHT.republish: not implemented" | 141 | error "DHT.republish: not implemented" |
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs index 33832aac..cbdc9ff8 100644 --- a/src/Network/BitTorrent/DHT/Session.hs +++ b/src/Network/BitTorrent/DHT/Session.hs | |||
@@ -20,17 +20,17 @@ module Network.BitTorrent.DHT.Session | |||
20 | , K | 20 | , K |
21 | , Options (..) | 21 | , Options (..) |
22 | 22 | ||
23 | -- * Node | 23 | -- * Session |
24 | , Node | 24 | , Node |
25 | , options | 25 | , options |
26 | , LogFun | 26 | , LogFun |
27 | , NodeHandler | 27 | , NodeHandler |
28 | , startNode | 28 | , startNode |
29 | 29 | ||
30 | -- * Session | 30 | -- * DHT |
31 | -- | Use @asks options@ to get options passed to 'startNode'. | ||
31 | , DHT | 32 | , DHT |
32 | , runDHT | 33 | , runDHT |
33 | , askOption | ||
34 | 34 | ||
35 | -- * Tokens | 35 | -- * Tokens |
36 | , grantToken | 36 | , grantToken |
@@ -292,10 +292,6 @@ runDHT :: Node ip -> DHT ip a -> ResIO a | |||
292 | runDHT node action = runReaderT (unDHT action) node | 292 | runDHT node action = runReaderT (unDHT action) node |
293 | {-# INLINE runDHT #-} | 293 | {-# INLINE runDHT #-} |
294 | 294 | ||
295 | askOption :: (Options -> a) -> DHT ip a | ||
296 | askOption f = asks (f . options) | ||
297 | {-# INLINE askOption #-} | ||
298 | |||
299 | {----------------------------------------------------------------------- | 295 | {----------------------------------------------------------------------- |
300 | -- Routing | 296 | -- Routing |
301 | -----------------------------------------------------------------------} | 297 | -----------------------------------------------------------------------} |