diff options
Diffstat (limited to 'Presence')
-rw-r--r-- | Presence/XMPPServer.hs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs index c037eb63..76275d15 100644 --- a/Presence/XMPPServer.hs +++ b/Presence/XMPPServer.hs | |||
@@ -398,6 +398,7 @@ sendModifiedStanzaToPeer stanza chan = do | |||
398 | sendModifiedStanzaToClient :: Stanza -> TChan Stanza -> IO () | 398 | sendModifiedStanzaToClient :: Stanza -> TChan Stanza -> IO () |
399 | sendModifiedStanzaToClient stanza chan = do | 399 | sendModifiedStanzaToClient stanza chan = do |
400 | (echan,clsrs,quitvar) <- conduitToChan c | 400 | (echan,clsrs,quitvar) <- conduitToChan c |
401 | -- wlog $ "send-to-client " ++ show (stanzaId stanza) | ||
401 | ioWriteChan chan | 402 | ioWriteChan chan |
402 | stanza { stanzaChan = echan | 403 | stanza { stanzaChan = echan |
403 | , stanzaClosers = clsrs | 404 | , stanzaClosers = clsrs |
@@ -680,7 +681,7 @@ findErrorTag ns = do | |||
680 | -> do | 681 | -> do |
681 | mtag <- findConditionTag | 682 | mtag <- findConditionTag |
682 | return $ do | 683 | return $ do |
683 | tag <- mtag | 684 | tag <- {- trace ("mtag = "++show mtag) -} mtag |
684 | let t = nameLocalName (tagName tag) | 685 | let t = nameLocalName (tagName tag) |
685 | conditionFromText t | 686 | conditionFromText t |
686 | _ -> findErrorTag ns | 687 | _ -> findErrorTag ns |
@@ -1120,6 +1121,8 @@ forkConnection sv xmpp k laddr pingflag src snk stanzas = do | |||
1120 | #else | 1121 | #else |
1121 | let notping f = f | 1122 | let notping f = f |
1122 | #endif | 1123 | #endif |
1124 | -- isempty <- atomically $ isEmptyTChan (stanzaChan stanza) | ||
1125 | -- kwlog $ "queuing: "++show (isempty, stanzaId stanza) | ||
1123 | notping $ do | 1126 | notping $ do |
1124 | dup <- atomically $ cloneStanza stanza | 1127 | dup <- atomically $ cloneStanza stanza |
1125 | let typ = Strict8.pack $ c ++ "<-"++(concat . take 1 . words $ show (stanzaType dup))++" " | 1128 | let typ = Strict8.pack $ c ++ "<-"++(concat . take 1 . words $ show (stanzaType dup))++" " |
@@ -1128,6 +1131,7 @@ forkConnection sv xmpp k laddr pingflag src snk stanzas = do | |||
1128 | PeerKey {} -> "P" | 1131 | PeerKey {} -> "P" |
1129 | wlog "" | 1132 | wlog "" |
1130 | stanzaToConduit dup $$ prettyPrint typ | 1133 | stanzaToConduit dup $$ prettyPrint typ |
1134 | -- wlog $ "hacks: "++show (stanzaId stanza) | ||
1131 | case stanzaType stanza of | 1135 | case stanzaType stanza of |
1132 | InternalEnableHack hack -> do | 1136 | InternalEnableHack hack -> do |
1133 | -- wlog $ "enable hack: " ++ show hack | 1137 | -- wlog $ "enable hack: " ++ show hack |
@@ -1155,8 +1159,8 @@ forkConnection sv xmpp k laddr pingflag src snk stanzas = do | |||
1155 | CL.sourceList sim =$= wrapStanzaConduit stanza -- not quite right, but whatever | 1159 | CL.sourceList sim =$= wrapStanzaConduit stanza -- not quite right, but whatever |
1156 | $$ awaitForever | 1160 | $$ awaitForever |
1157 | $ liftIO . atomically . Slotted.push slots Nothing | 1161 | $ liftIO . atomically . Slotted.push slots Nothing |
1158 | Error {} -> do | 1162 | Error e _ -> do |
1159 | wlog $ "no hacks for error: " ++ show (stanzaType stanza) | 1163 | wlog $ "no hacks for error: " ++ show e |
1160 | _ -> return () | 1164 | _ -> return () |
1161 | loop | 1165 | loop |
1162 | ,do pingflag >>= check | 1166 | ,do pingflag >>= check |
@@ -1470,9 +1474,13 @@ monitor sv params xmpp = do | |||
1470 | _ -> return () | 1474 | _ -> return () |
1471 | , readTChan stanzas >>= \stanza -> return $ do | 1475 | , readTChan stanzas >>= \stanza -> return $ do |
1472 | dup <- case stanzaType stanza of | 1476 | dup <- case stanzaType stanza of |
1477 | -- Must dup anything that is going to be delivered... | ||
1473 | Message {} -> do | 1478 | Message {} -> do |
1474 | dup <- atomically $ cloneStanza stanza -- dupped so we can make debug print | 1479 | dup <- atomically $ cloneStanza stanza -- dupped so we can make debug print |
1475 | return dup | 1480 | return dup |
1481 | Error {} -> do | ||
1482 | dup <- atomically $ cloneStanza stanza -- dupped so we can make debug print | ||
1483 | return dup | ||
1476 | _ -> return stanza | 1484 | _ -> return stanza |
1477 | forkIO $ do | 1485 | forkIO $ do |
1478 | case stanzaOrigin stanza of | 1486 | case stanzaOrigin stanza of |
@@ -1552,7 +1560,10 @@ monitor sv params xmpp = do | |||
1552 | Error {} -> do | 1560 | Error {} -> do |
1553 | case stanzaOrigin stanza of | 1561 | case stanzaOrigin stanza of |
1554 | LocalPeer {} -> return () | 1562 | LocalPeer {} -> return () |
1555 | NetworkOrigin _ replyto -> deliver replyto | 1563 | NetworkOrigin k replyto -> do |
1564 | -- wlog $ "delivering error: " ++show (stanzaId stanza) | ||
1565 | -- wlog $ " from: " ++ show k | ||
1566 | deliver replyto | ||
1556 | _ -> return () | 1567 | _ -> return () |
1557 | -- We need to clone in the case the stanza is passed on as for Message. | 1568 | -- We need to clone in the case the stanza is passed on as for Message. |
1558 | #ifndef PINGNOISE | 1569 | #ifndef PINGNOISE |