diff options
Diffstat (limited to 'Presence/XMPP.hs')
-rw-r--r-- | Presence/XMPP.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Presence/XMPP.hs b/Presence/XMPP.hs index 84035ea2..7a0bb1a2 100644 --- a/Presence/XMPP.hs +++ b/Presence/XMPP.hs | |||
@@ -636,9 +636,9 @@ listenForRemotePeers addrfamily session_factory port st = do | |||
636 | doServer (addrfamily .*. port .*. session_factory .*. st) handlePeer | 636 | doServer (addrfamily .*. port .*. session_factory .*. st) handlePeer |
637 | 637 | ||
638 | handlePeer | 638 | handlePeer |
639 | :: (SocketLike sock, HHead l (XMPPPeerClass session), | 639 | :: (HHead l (XMPPPeerClass session), |
640 | JabberPeerSession session) => | 640 | JabberPeerSession session) => |
641 | HCons sock (HCons t1 l) -> Source IO ByteString -> t -> IO () | 641 | HCons RestrictedSocket (HCons t1 l) -> Source IO ByteString -> t -> IO () |
642 | handlePeer st src snk = do | 642 | handlePeer st src snk = do |
643 | let HCons sock (HCons _ st') = st | 643 | let HCons sock (HCons _ st') = st |
644 | session_factory = hHead st' | 644 | session_factory = hHead st' |
@@ -646,7 +646,7 @@ handlePeer st src snk = do | |||
646 | debugL $ "(P) connected " <++> name | 646 | debugL $ "(P) connected " <++> name |
647 | session <- newPeerSession session_factory sock | 647 | session <- newPeerSession session_factory sock |
648 | 648 | ||
649 | finally ( src $= parseBytes def $$ fromPeer session ) | 649 | finally ( src $= parseBytes def $$ fromPeer sock session ) |
650 | $ do | 650 | $ do |
651 | debugL $ "(P) disconnected " <++> name | 651 | debugL $ "(P) disconnected " <++> name |
652 | closePeerSession session | 652 | closePeerSession session |
@@ -912,8 +912,8 @@ handlePeerIQGet session tag = do | |||
912 | req -> unhandledGet req | 912 | req -> unhandledGet req |
913 | 913 | ||
914 | fromPeer :: (MonadThrow m,MonadIO m, JabberPeerSession session) => | 914 | fromPeer :: (MonadThrow m,MonadIO m, JabberPeerSession session) => |
915 | session -> Sink XML.Event m () | 915 | RestrictedSocket -> session -> Sink XML.Event m () |
916 | fromPeer session = doNestingXML $ do | 916 | fromPeer sock session = doNestingXML $ do |
917 | let log = liftIO . debugL . ("(P) " <++>) | 917 | let log = liftIO . debugL . ("(P) " <++>) |
918 | withXML $ \begindoc -> do | 918 | withXML $ \begindoc -> do |
919 | when (begindoc==EventBeginDocument) $ do | 919 | when (begindoc==EventBeginDocument) $ do |
@@ -927,7 +927,7 @@ fromPeer session = doNestingXML $ do | |||
927 | whenJust nextElement $ \stanza -> do | 927 | whenJust nextElement $ \stanza -> do |
928 | stanza_lvl <- nesting | 928 | stanza_lvl <- nesting |
929 | 929 | ||
930 | liftIO $ sendPeerMessage session ActivityBump -- reset ping timer | 930 | liftIO $ sendPeerMessage session (ActivityBump sock) -- reset ping timer |
931 | 931 | ||
932 | let unhandledStanza = do | 932 | let unhandledStanza = do |
933 | xs <- gatherElement stanza Seq.empty | 933 | xs <- gatherElement stanza Seq.empty |
@@ -987,7 +987,7 @@ instance CommandCache CachedMessages where | |||
987 | updateCache (OutBoundMessage msg) cache = cache -- TODO: cache chat? | 987 | updateCache (OutBoundMessage msg) cache = cache -- TODO: cache chat? |
988 | updateCache (Pong _ _ _) cache = cache -- pings are not cached | 988 | updateCache (Pong _ _ _) cache = cache -- pings are not cached |
989 | updateCache (Unsupported _ _ _ _) cache = cache -- error messages are not cached | 989 | updateCache (Unsupported _ _ _ _) cache = cache -- error messages are not cached |
990 | updateCache ActivityBump cache = cache | 990 | updateCache (ActivityBump sock) cache = cache |
991 | 991 | ||
992 | instance ThreadChannelCommand OutBoundMessage where | 992 | instance ThreadChannelCommand OutBoundMessage where |
993 | isQuitCommand Disconnect = True | 993 | isQuitCommand Disconnect = True |
@@ -1143,7 +1143,7 @@ toPeer sock cache chan fail = do | |||
1143 | pingref <- liftIO $ do | 1143 | pingref <- liftIO $ do |
1144 | ping_timer <- liftIO $ newDelay five_sec | 1144 | ping_timer <- liftIO $ newDelay five_sec |
1145 | newTVarIO (ping_timer,0::Int) | 1145 | newTVarIO (ping_timer,0::Int) |
1146 | let bump = do | 1146 | let bump fromsock = do |
1147 | timer <- atomically $ do | 1147 | timer <- atomically $ do |
1148 | (timer,v) <- readTVar pingref | 1148 | (timer,v) <- readTVar pingref |
1149 | writeTVar pingref (timer,0) | 1149 | writeTVar pingref (timer,0) |
@@ -1206,7 +1206,7 @@ toPeer sock cache chan fail = do | |||
1206 | Pong from to mid -> sendPong from to mid | 1206 | Pong from to mid -> sendPong from to mid |
1207 | Unsupported from to mid tag -> sendUnsupported from to mid tag | 1207 | Unsupported from to mid tag -> sendUnsupported from to mid tag |
1208 | Disconnect -> return () | 1208 | Disconnect -> return () |
1209 | ActivityBump -> liftIO bump | 1209 | ActivityBump fromsock -> liftIO (bump fromsock) |
1210 | when (not . isQuitCommand $ event) loop | 1210 | when (not . isQuitCommand $ event) loop |
1211 | either chanEvent sendPing event | 1211 | either chanEvent sendPing event |
1212 | return () | 1212 | return () |