summaryrefslogtreecommitdiff
path: root/src/Network/Tox.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/Tox.hs')
-rw-r--r--src/Network/Tox.hs9
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
19import Control.Exception hiding (Handler) 19import Control.Exception hiding (Handler)
20import Control.Applicative 20import Control.Applicative
21import Control.Arrow 21import Control.Arrow
22import Control.Concurrent (MVar) 22import Control.Concurrent (MVar,killThread)
23import Control.Concurrent.STM 23import Control.Concurrent.STM
24import Control.Monad 24import Control.Monad
25import Control.Monad.Fix 25import 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'.
494announceToLan :: Socket -> NodeId -> IO () 495announceToLan :: Socket -> NodeId -> IO ()
495announceToLan sock nid = do 496announceToLan 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)