diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dhtd.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 57ee8deb..bb491bfc 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -395,6 +395,7 @@ data Session = Session | |||
395 | , toxkeys :: TVar Tox.AnnouncedKeys | 395 | , toxkeys :: TVar Tox.AnnouncedKeys |
396 | , userkeys :: TVar [(SecretKey,PublicKey)] | 396 | , userkeys :: TVar [(SecretKey,PublicKey)] |
397 | , roster :: Tox.ContactInfo | 397 | , roster :: Tox.ContactInfo |
398 | , announceToLan :: IO () | ||
398 | , sessions :: TVar [PerSession] | 399 | , sessions :: TVar [PerSession] |
399 | , connectionManager :: Maybe ConnectionManager | 400 | , connectionManager :: Maybe ConnectionManager |
400 | , onionRouter :: OnionRouter | 401 | , onionRouter :: OnionRouter |
@@ -469,6 +470,7 @@ clientSession s@Session{..} sock cnum h = do | |||
469 | , ["threads"] | 470 | , ["threads"] |
470 | , ["mem"] | 471 | , ["mem"] |
471 | , ["nid"] | 472 | , ["nid"] |
473 | , ["lan"] | ||
472 | , ["ls"] | 474 | , ["ls"] |
473 | , ["k"] | 475 | , ["k"] |
474 | , ["roster"] | 476 | , ["roster"] |
@@ -574,6 +576,10 @@ clientSession s@Session{..} sock cnum h = do | |||
574 | Right nid -> show nid ++ " nospam:" ++ drop 64 s | 576 | Right nid -> show nid ++ " nospam:" ++ drop 64 s |
575 | Right nid -> show nid | 577 | Right nid -> show nid |
576 | 578 | ||
579 | ("lan", _) -> cmd0 $ do | ||
580 | announceToLan | ||
581 | hPutClient h "ok" | ||
582 | |||
577 | ("ls", _) | Just DHT{dhtBuckets} <- Map.lookup netname dhts | 583 | ("ls", _) | Just DHT{dhtBuckets} <- Map.lookup netname dhts |
578 | -> cmd0 $ do | 584 | -> cmd0 $ do |
579 | bkts <- atomically $ readTVar dhtBuckets | 585 | bkts <- atomically $ readTVar dhtBuckets |
@@ -1640,6 +1646,7 @@ main = runResourceT $ liftBaseWith $ \resT -> do | |||
1640 | , toxkeys = keysdb | 1646 | , toxkeys = keysdb |
1641 | , userkeys = toxids | 1647 | , userkeys = toxids |
1642 | , roster = rstr | 1648 | , roster = rstr |
1649 | , announceToLan = fromMaybe (return ()) $ Tox.toxAnnounceToLan <$> mbtox | ||
1643 | , sessions = sessions | 1650 | , sessions = sessions |
1644 | , connectionManager = ConnectionManager <$> mconns | 1651 | , connectionManager = ConnectionManager <$> mconns |
1645 | , onionRouter = orouter | 1652 | , onionRouter = orouter |