diff options
Diffstat (limited to 'src/Network/Tox.hs')
-rw-r--r-- | src/Network/Tox.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs index 5bd23da8..3c3bce49 100644 --- a/src/Network/Tox.hs +++ b/src/Network/Tox.hs | |||
@@ -19,7 +19,7 @@ import Debug.Trace | |||
19 | import Control.Exception hiding (Handler) | 19 | import Control.Exception hiding (Handler) |
20 | import Control.Applicative | 20 | import Control.Applicative |
21 | import Control.Arrow | 21 | import Control.Arrow |
22 | import Control.Concurrent (MVar) | 22 | import Control.Concurrent (MVar,killThread) |
23 | import Control.Concurrent.STM | 23 | import Control.Concurrent.STM |
24 | import Control.Monad | 24 | import Control.Monad |
25 | import Control.Monad.Fix | 25 | import Control.Monad.Fix |
@@ -485,18 +485,19 @@ forkTox tox = do | |||
485 | quit <- forkListener "toxCrypto" (toxCrypto tox) | 485 | quit <- forkListener "toxCrypto" (toxCrypto tox) |
486 | forkPollForRefresh (DHT.refresher4 $ toxRouting tox) | 486 | forkPollForRefresh (DHT.refresher4 $ toxRouting tox) |
487 | forkPollForRefresh (DHT.refresher6 $ toxRouting tox) | 487 | forkPollForRefresh (DHT.refresher6 $ toxRouting tox) |
488 | return ( quit | 488 | keygc <- Onion.forkAnnouncedKeysGC (toxAnnouncedKeys tox) |
489 | return ( killThread keygc >> quit | ||
489 | , bootstrap (DHT.refresher4 $ toxRouting tox) | 490 | , bootstrap (DHT.refresher4 $ toxRouting tox) |
490 | , bootstrap (DHT.refresher6 $ toxRouting tox) | 491 | , bootstrap (DHT.refresher6 $ toxRouting tox) |
491 | ) | 492 | ) |
492 | 493 | ||
493 | -- TODO: Don't export this. | 494 | -- TODO: Don't export this. The exported interface is 'toxAnnounceToLan'. |
494 | announceToLan :: Socket -> NodeId -> IO () | 495 | announceToLan :: Socket -> NodeId -> IO () |
495 | announceToLan sock nid = do | 496 | announceToLan sock nid = do |
496 | addrs <- broadcastAddrs | 497 | addrs <- broadcastAddrs |
497 | forM_ addrs $ \addr -> do | 498 | forM_ addrs $ \addr -> do |
498 | (broadcast_info:_) <- getAddrInfo (Just defaultHints { addrFlags = [AI_NUMERICHOST], addrSocketType = Datagram }) | 499 | (broadcast_info:_) <- getAddrInfo (Just defaultHints { addrFlags = [AI_NUMERICHOST], addrSocketType = Datagram }) |
499 | (Just addr) -- TODO: Detect broadcast address. | 500 | (Just addr) |
500 | (Just "33445") | 501 | (Just "33445") |
501 | let broadcast = addrAddress broadcast_info | 502 | let broadcast = addrAddress broadcast_info |
502 | bs = S.runPut $ DHT.putMessage (DHT.DHTLanDiscovery nid) | 503 | bs = S.runPut $ DHT.putMessage (DHT.DHTLanDiscovery nid) |