diff options
author | joe <joe@jerkface.net> | 2017-11-04 22:21:24 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-11-04 22:21:24 -0400 |
commit | 8903c7e0b9eea11dbf229747e7f9729bfe5d2f7b (patch) | |
tree | a15d464c97bbad2a9f256f5fb52c8375b11ca9d3 /examples | |
parent | f045f7e473b534cbe4dff70420e4cc0184465e54 (diff) |
Quieter output and some bug fixes.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dhtd.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index c06b69d1..dc99642d 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -413,6 +413,8 @@ clientSession0 :: Session -> t1 -> t -> Handle -> IO () | |||
413 | clientSession0 s sock cnum h = do | 413 | clientSession0 s sock cnum h = do |
414 | hstate <- newMVar 1 -- ready for input | 414 | hstate <- newMVar 1 -- ready for input |
415 | clientSession s sock cnum (ClientHandle h hstate) | 415 | clientSession s sock cnum (ClientHandle h hstate) |
416 | `catch` \e -> if isEOFError e then return () | ||
417 | else throwIO e | ||
416 | 418 | ||
417 | clientSession :: Session -> t1 -> t -> ClientHandle -> IO () | 419 | clientSession :: Session -> t1 -> t -> ClientHandle -> IO () |
418 | clientSession s@Session{..} sock cnum h = do | 420 | clientSession s@Session{..} sock cnum h = do |
@@ -801,7 +803,9 @@ clientSession s@Session{..} sock cnum h = do | |||
801 | (qresultAddr dta) | 803 | (qresultAddr dta) |
802 | announceInterval) | 804 | announceInterval) |
803 | dta | 805 | dta |
804 | hPutClient h $ "Announcing at " ++ show (qresultAddr dta) ++ "." | 806 | case op of |
807 | '+' -> hPutClient h $ "Announcing at " ++ show (qresultAddr dta) ++ "." | ||
808 | '-' -> hPutClient h $ "Canceling " ++ show (qresultAddr dta) ++ "." | ||
805 | let aerror = unlines | 809 | let aerror = unlines |
806 | [ "announce error." | 810 | [ "announce error." |
807 | , "method = " ++ method | 811 | , "method = " ++ method |
@@ -972,7 +976,8 @@ sensibleDefaults = Options | |||
972 | -- -4 | 976 | -- -4 |
973 | parseArgs :: [String] -> Options -> Options | 977 | parseArgs :: [String] -> Options -> Options |
974 | parseArgs [] opts = opts | 978 | parseArgs [] opts = opts |
975 | parseArgs ("--dhtkey":k:args) opts = opts { dhtkey = decodeSecret $ B.pack k } | 979 | parseArgs ("--dhtkey":k:args) opts = parseArgs args opts |
980 | { dhtkey = decodeSecret $ B.pack k } | ||
976 | parseArgs ("-4":args) opts = parseArgs args opts | 981 | parseArgs ("-4":args) opts = parseArgs args opts |
977 | { ip6bt = False | 982 | { ip6bt = False |
978 | , ip6tox = False } | 983 | , ip6tox = False } |
@@ -1099,6 +1104,7 @@ main = do | |||
1099 | "" -> return (Nothing,return (), Map.empty, return [],[]) | 1104 | "" -> return (Nothing,return (), Map.empty, return [],[]) |
1100 | toxport -> do | 1105 | toxport -> do |
1101 | addrTox <- getBindAddress toxport (ip6tox opts) | 1106 | addrTox <- getBindAddress toxport (ip6tox opts) |
1107 | hPutStrLn stderr $ "Supplied key: " ++ show (fmap (Tox.key2id . toPublic) (dhtkey opts)) | ||
1102 | tox <- Tox.newTox keysdb addrTox (Just netCryptoSessionsState) (dhtkey opts) | 1108 | tox <- Tox.newTox keysdb addrTox (Just netCryptoSessionsState) (dhtkey opts) |
1103 | quitTox <- Tox.forkTox tox | 1109 | quitTox <- Tox.forkTox tox |
1104 | 1110 | ||
@@ -1274,7 +1280,7 @@ main = do | |||
1274 | let defaultToxData = do | 1280 | let defaultToxData = do |
1275 | toxids <- atomically $ newTVar [] | 1281 | toxids <- atomically $ newTVar [] |
1276 | rster <- newRoster | 1282 | rster <- newRoster |
1277 | orouter <- newOnionRouter | 1283 | orouter <- newOnionRouter (hPutStrLn stderr) |
1278 | return (toxids, rster, orouter) | 1284 | return (toxids, rster, orouter) |
1279 | (toxids,rstr,orouter) <- fromMaybe defaultToxData $ do | 1285 | (toxids,rstr,orouter) <- fromMaybe defaultToxData $ do |
1280 | tox <- mbtox | 1286 | tox <- mbtox |