diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dhtd.hs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 2b4de91e..d6049c13 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -1531,7 +1531,7 @@ ioToSource !action !onEOF = liftIO action >>= \case | |||
1531 | ioToSource action onEOF | 1531 | ioToSource action onEOF |
1532 | 1532 | ||
1533 | newXmmpSink :: Tox.NetCryptoSession -> C.Sink (Flush Tox.CryptoMessage) IO () | 1533 | newXmmpSink :: Tox.NetCryptoSession -> C.Sink (Flush Tox.CryptoMessage) IO () |
1534 | newXmmpSink session@(Tox.NCrypto { ncOutgoingQueue = outGoingQVar, ncPacketQueue }) = C.awaitForever $ \flush_cyptomessage -> do | 1534 | newXmmpSink session@(Tox.NCrypto { ncOutgoingQueue = outGoingQVar }) = C.awaitForever $ \flush_cyptomessage -> do |
1535 | let sendit :: Tox.NetCryptoSession -> Flush Tox.CryptoMessage -> IO () | 1535 | let sendit :: Tox.NetCryptoSession -> Flush Tox.CryptoMessage -> IO () |
1536 | sendit session (Chunk msg) = do | 1536 | sendit session (Chunk msg) = do |
1537 | outq <- atomically $ do | 1537 | outq <- atomically $ do |
@@ -1539,15 +1539,19 @@ newXmmpSink session@(Tox.NCrypto { ncOutgoingQueue = outGoingQVar, ncPacketQueue | |||
1539 | case mbOutq of | 1539 | case mbOutq of |
1540 | Tox.HaveHandshake outq -> return outq | 1540 | Tox.HaveHandshake outq -> return outq |
1541 | Tox.NeedHandshake -> retry | 1541 | Tox.NeedHandshake -> retry |
1542 | extra <- readyOutGoing outq | 1542 | extra <- Tox.nqToWireIO outq |
1543 | r <- atomically $ do | 1543 | r <- atomically $ do |
1544 | rTry <- tryAppendQueueOutgoing extra outq msg | 1544 | rTry <- Tox.tryAppendQueueOutgoing extra outq msg |
1545 | case rTry of | 1545 | case rTry of |
1546 | OGFull -> retry | 1546 | Tox.OGFull -> retry |
1547 | OGSuccess x -> return (OGSuccess x) | 1547 | Tox.OGSuccess x -> return (Tox.OGSuccess x) |
1548 | OGEncodeFail -> return OGEncodeFail | 1548 | Tox.OGEncodeFail -> return Tox.OGEncodeFail |
1549 | when (r == OGEncodeFail) $ | 1549 | case r of |
1550 | dput XMisc ("FAILURE to Encode Outgoing: " ++ show msg) | 1550 | Tox.OGSuccess x -> case Tox.ncSockAddr session of |
1551 | Tox.HaveDHTKey saddr -> Tox.sendSessionPacket (Tox.ncAllSessions session) saddr x | ||
1552 | _ -> return () | ||
1553 | Tox.OGEncodeFail -> dput XMisc ("FAILURE to Encode Outgoing: " ++ show msg) | ||
1554 | _ -> return () | ||
1551 | sendit session Flush = return () | 1555 | sendit session Flush = return () |
1552 | liftIO $ sendit session flush_cyptomessage | 1556 | liftIO $ sendit session flush_cyptomessage |
1553 | 1557 | ||