Browse Source

change pullStanza to not block the stream

add debugging information for outgoing stanzas over TLS
cleanup in Xmpp.Concurrent.Threads
master
Philipp Balzarek 13 years ago
parent
commit
1f3a18f2ef
  1. 5
      source/Network/Xmpp/Concurrent/Threads.hs
  2. 2
      source/Network/Xmpp/Stream.hs
  3. 4
      source/Network/Xmpp/Tls.hs

5
source/Network/Xmpp/Concurrent/Threads.hs

@ -78,10 +78,7 @@ startThreadsWith :: (Stanza -> IO ()) @@ -78,10 +78,7 @@ startThreadsWith :: (Stanza -> IO ())
TMVar Stream,
ThreadId))
startThreadsWith stanzaHandler eh con = do
rd <- withStream' (gets $ streamSend . streamHandle >>= \d -> return $ Right d) con
case rd of
Left e -> return $ Left e
Right read' -> do
read' <- withStream' (gets $ streamSend . streamHandle) con
writeLock <- newTMVarIO read'
conS <- newTMVarIO con
-- lw <- forkIO $ writeWorker outC writeLock

2
source/Network/Xmpp/Stream.hs

@ -429,7 +429,7 @@ pullUnpickle p = do @@ -429,7 +429,7 @@ pullUnpickle p = do
-- | Pulls a stanza (or stream error) from the stream.
pullStanza :: Stream -> IO (Either XmppFailure Stanza)
pullStanza = withStream $ do
pullStanza = withStream' $ do
res <- pullUnpickle xpStreamStanza
case res of
Left e -> return $ Left e

4
source/Network/Xmpp/Tls.hs

@ -134,7 +134,9 @@ tlsinit params backend = do @@ -134,7 +134,9 @@ tlsinit params backend = do
readWithBuffer <- liftIO $ mkReadBuffer (recvData con)
return ( src
, snk
, \s -> sendData con $ BL.fromChunks [s]
, \s -> do
liftIO $ debugM "Pontarius.Xmpp.TLS" ("out :" ++ BSC8.unpack s)
sendData con $ BL.fromChunks [s]
, liftIO . readWithBuffer
, con
)

Loading…
Cancel
Save