[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36

John Goerzen jgoerzen at complete.org
Fri Apr 23 14:52:34 UTC 2010


The following commit has been merged in the master branch:
commit a461f3299c0e6de4bc6ca6579639fe7a2dcea0b3
Author: John Goerzen <jgoerzen at complete.org>
Date:   Tue Dec 21 23:11:44 2004 +0100

    Checkpointing
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.7--patch-123)

diff --git a/ChangeLog b/ChangeLog
index cc297a8..14aab8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,19 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
 #
 
+2004-12-21 16:11:44 GMT	John Goerzen <jgoerzen at complete.org>	patch-123
+
+    Summary:
+      Checkpointing
+    Revision:
+      missingh--head--0.7--patch-123
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/Network/FTP/Server.hs
+     libsrc/MissingH/Network/SocketServer.hs
+
+
 2004-12-21 15:31:16 GMT	John Goerzen <jgoerzen at complete.org>	patch-122
 
     Summary:
diff --git a/libsrc/MissingH/Network/FTP/Server.hs b/libsrc/MissingH/Network/FTP/Server.hs
index 8802f47..94c191d 100644
--- a/libsrc/MissingH/Network/FTP/Server.hs
+++ b/libsrc/MissingH/Network/FTP/Server.hs
@@ -44,4 +44,22 @@ import System.IO
 import MissingH.Logging.Logger
 import MissingH.Network
 import MissingH.Str
+import MissingH.Printf
+import MissingH.IO.HVIO
 
+s_crlf = "\r\n"
+ftpPutStrLn :: Handle -> String -> IO ()
+ftpPutStrLn h text =
+    hPutStr h (text ++ s_crlf)
+
+{- | Send a reply code, handling multi-line text as necessary. -}
+sendReply :: Handle -> Int -> String -> IO ()
+sendReply h codei text =
+    let codes = vsprintf "%03d" codei
+        writethis [] = ftpPutStrLn h (codes ++ "  ")
+        writethis [item] = ftpPutStrLn h (codes ++ " " ++ item)
+        writethis (item:xs) = do ftpPutStrLn h (codes ++ "-" ++ item)
+                                 writethis xs
+        in 
+        writethis (map (rstrip) (lines text))
+        
diff --git a/libsrc/MissingH/Network/SocketServer.hs b/libsrc/MissingH/Network/SocketServer.hs
index 47b1a3b..c5ec8f6 100644
--- a/libsrc/MissingH/Network/SocketServer.hs
+++ b/libsrc/MissingH/Network/SocketServer.hs
@@ -120,15 +120,19 @@ threadedHandler nexth socket sockaddr =
     do forkIO (nexth socket sockaddr)
        return ()
 
-{- | Give your handler function a Handle instead of a Socket and SockAddr.
+{- | Give your handler function a Handle instead of a Socket.
 
 The Handle will be opened with ReadWriteMode (you use one handle for both
 directions of the Socket).  Also, it will be initialized with LineBuffering.
+
+Unlike other handlers, the handle will be closed when the function returns.
+Therefore, if you are doing threading, you should to it before you call this
+handler.
 -}
-handleHandler :: (Handle -> IO ())      -- ^ Handler to call
+handleHandler :: (Handle -> SockAddr -> IO ())      -- ^ Handler to call
               -> HandlerT
-handleHandler func socket _ = 
+handleHandler func socket sockaddr = 
     do h <- socketToHandle socket ReadWriteMode
        hSetBuffering h LineBuffering
-       func h
-
+       func h sockaddr
+       hClose h

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list