summaryrefslogtreecommitdiff
path: root/Presence/XMPP.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Presence/XMPP.hs')
-rw-r--r--Presence/XMPP.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Presence/XMPP.hs b/Presence/XMPP.hs
index c7525159..4db055ea 100644
--- a/Presence/XMPP.hs
+++ b/Presence/XMPP.hs
@@ -922,12 +922,14 @@ fromPeer sock session = doNestingXML $ do
922 withJust (elementAttrs "stream" xml) $ \stream_attrs -> do 922 withJust (elementAttrs "stream" xml) $ \stream_attrs -> do
923 log $ "stream atributes: " <++> bshow stream_attrs 923 log $ "stream atributes: " <++> bshow stream_attrs
924 924
925 let doTimeout = Thunk (closePeerSession session)
926
925 fix $ \loop -> do 927 fix $ \loop -> do
926 log "waiting for stanza." 928 log "waiting for stanza."
927 whenJust nextElement $ \stanza -> do 929 whenJust nextElement $ \stanza -> do
928 stanza_lvl <- nesting 930 stanza_lvl <- nesting
929 931
930 liftIO $ sendPeerMessage session (ActivityBump sock) -- reset ping timer 932 liftIO $ sendPeerMessage session (ActivityBump doTimeout) -- reset ping timer
931 933
932 let unhandledStanza = do 934 let unhandledStanza = do
933 xs <- gatherElement stanza Seq.empty 935 xs <- gatherElement stanza Seq.empty
@@ -1181,7 +1183,9 @@ toPeer sock cache chan fail = do
1181 remote <- liftIO $ getPeerName sock 1183 remote <- liftIO $ getPeerName sock
1182 liftIO . debugL $ "PING TIMEOUT: " <++> showPeer (RemotePeer remote) 1184 liftIO . debugL $ "PING TIMEOUT: " <++> showPeer (RemotePeer remote)
1183 fromsock <- liftIO $ atomically $ readTMVar sockref 1185 fromsock <- liftIO $ atomically $ readTMVar sockref
1184 liftIO $ sClose fromsock 1186 -- liftIO $ sClose fromsock
1187 liftIO $ runThunk fromsock
1188
1185 return () -- PING TIMEOUT (loop quits) 1189 return () -- PING TIMEOUT (loop quits)
1186 x -> error ("What? "++show x) 1190 x -> error ("What? "++show x)
1187 where makePing = do 1191 where makePing = do