diff options
author | Andrew Cady <d@jerkface.net> | 2018-06-24 05:02:34 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2018-06-24 06:40:09 -0400 |
commit | c781c88c3cd77b70694a26c3f27ff82aa6fa65d3 (patch) | |
tree | 02b8e3635677f073eb959a8f6224e98ad85993ac /examples | |
parent | 4c045e987892a0b32d86a93f0f521f497213341e (diff) |
Fixed handshake behavior
The handshake code would flood the network with interminable handshakes.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dhtd.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index c03df3cc..9b5abb22 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -1065,7 +1065,7 @@ clientSession s@Session{..} sock cnum h = do | |||
1065 | rs <- atomically $ do | 1065 | rs <- atomically $ do |
1066 | as <- scheduleToList announcer | 1066 | as <- scheduleToList announcer |
1067 | forM (as) $ \(k,ptm,item) -> do | 1067 | forM (as) $ \(k,ptm,item) -> do |
1068 | kstr <- unpackAnnounceKey announcer k | 1068 | let kstr = unpackAnnounceKey announcer k |
1069 | return [ if ptm==0 then "now" | 1069 | return [ if ptm==0 then "now" |
1070 | else show (ptm - now) | 1070 | else show (ptm - now) |
1071 | , show (itemStatusNum item) | 1071 | , show (itemStatusNum item) |
@@ -1124,7 +1124,7 @@ clientSession s@Session{..} sock cnum h = do | |||
1124 | -- return $ hPutClient h "Type matches." | 1124 | -- return $ hPutClient h "Type matches." |
1125 | dta <- either (const Nothing) Just $ announceParseData dtastr | 1125 | dta <- either (const Nothing) Just $ announceParseData dtastr |
1126 | return $ do | 1126 | return $ do |
1127 | akey <- atomically $ packAnnounceKey announcer (method ++ ":" ++ dtastr) | 1127 | let akey = packAnnounceKey announcer (method ++ ":" ++ dtastr) |
1128 | doitR op announcer | 1128 | doitR op announcer |
1129 | akey | 1129 | akey |
1130 | (AnnounceMethod qsearch asend | 1130 | (AnnounceMethod qsearch asend |
@@ -1150,7 +1150,7 @@ clientSession s@Session{..} sock cnum h = do | |||
1150 | dta <- either (const Nothing) Just $ announceParseData dtastr | 1150 | dta <- either (const Nothing) Just $ announceParseData dtastr |
1151 | pub <- selectedKey | 1151 | pub <- selectedKey |
1152 | return $ do | 1152 | return $ do |
1153 | akey <- atomically $ packAnnounceKey announcer (method ++ ":" ++ dtastr) | 1153 | let akey = packAnnounceKey announcer (method ++ ":" ++ dtastr) |
1154 | doitL op announcer | 1154 | doitL op announcer |
1155 | akey | 1155 | akey |
1156 | (SearchMethod qsearch (asend pub) | 1156 | (SearchMethod qsearch (asend pub) |
@@ -1352,7 +1352,7 @@ netcrypto (Just (DHT {..})) (Just mypubkey) h roster (Just tox) exes paramStr = | |||
1352 | Nothing -> hPutClient h "Unable to find account for selected key" | 1352 | Nothing -> hPutClient h "Unable to find account for selected key" |
1353 | Just account -> do | 1353 | Just account -> do |
1354 | now <- getPOSIXTime | 1354 | now <- getPOSIXTime |
1355 | atomically $ setContactAddr now their_pub their_addr account | 1355 | atomically $ setContactAddr now their_pub (_fixme their_addr) account |
1356 | sessions <- Tox.netCrypto tox sec their_pub | 1356 | sessions <- Tox.netCrypto tox sec their_pub |
1357 | exeDir <- takeDirectory <$> getExecutablePath | 1357 | exeDir <- takeDirectory <$> getExecutablePath |
1358 | forM_ sessions $ \session -> do | 1358 | forM_ sessions $ \session -> do |