diff options
author | joe <joe@jerkface.net> | 2014-02-18 19:25:13 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2014-02-18 19:25:13 -0500 |
commit | 94bd6f5bfb300722454ffe91034118b90dfe4505 (patch) | |
tree | 30c8f68136775fc7b4d15e00cd7897f2115a3d1b /Presence/XMPPServer.hs | |
parent | e8e889cf562954c82aa53c940b21782b16d63b97 (diff) |
wrapStanzaConduit for detection of interrupted stanzas
Diffstat (limited to 'Presence/XMPPServer.hs')
-rw-r--r-- | Presence/XMPPServer.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs index f29179e5..6e0f5c5f 100644 --- a/Presence/XMPPServer.hs +++ b/Presence/XMPPServer.hs | |||
@@ -731,6 +731,13 @@ wrapStanzaList xs = do | |||
731 | mfrom = m >>= lookupAttrib "from" . tagAttrs | 731 | mfrom = m >>= lookupAttrib "from" . tagAttrs |
732 | mid = m >>= lookupAttrib "id" . tagAttrs | 732 | mid = m >>= lookupAttrib "id" . tagAttrs |
733 | 733 | ||
734 | wrapStanzaConduit stanza = do | ||
735 | mfirst <- await | ||
736 | flip (maybe $ return ()) mfirst $ \first -> do | ||
737 | yield . Left $ stanza { stanzaChan = first } | ||
738 | awaitForever $ yield . Right | ||
739 | |||
740 | |||
734 | 741 | ||
735 | {- | 742 | {- |
736 | greet namespace = | 743 | greet namespace = |
@@ -838,9 +845,9 @@ forkConnection sv xmpp k laddr pingflag src snk stanzas = do | |||
838 | PeerKey {} -> "P" | 845 | PeerKey {} -> "P" |
839 | wlog "" | 846 | wlog "" |
840 | stanzaToConduit dup $$ prettyPrint typ | 847 | stanzaToConduit dup $$ prettyPrint typ |
841 | stanzaToConduit stanza | 848 | stanzaToConduit stanza =$= wrapStanzaConduit stanza |
842 | $$ awaitForever | 849 | $$ awaitForever |
843 | $ liftIO . atomically . Slotted.push slots Nothing . Right | 850 | $ liftIO . atomically . Slotted.push slots Nothing |
844 | loop | 851 | loop |
845 | ,do pingflag >>= check | 852 | ,do pingflag >>= check |
846 | return $ do | 853 | return $ do |