diff options
Diffstat (limited to 'Presence/Server.hs')
-rw-r--r-- | Presence/Server.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Presence/Server.hs b/Presence/Server.hs index 55a8b57b..80a6e4ba 100644 --- a/Presence/Server.hs +++ b/Presence/Server.hs | |||
@@ -35,6 +35,11 @@ newtype ConnectionFinalizer = ConnectionFinalizer (IO ()) | |||
35 | 35 | ||
36 | getPacket h = do { hWaitForInput h (-1) ; fmap (fromChunks . (:[])) $ hGetNonBlocking h 1024 } | 36 | getPacket h = do { hWaitForInput h (-1) ; fmap (fromChunks . (:[])) $ hGetNonBlocking h 1024 } |
37 | 37 | ||
38 | newtype ServerHandle = ServerHandle Socket | ||
39 | |||
40 | quitListening :: ServerHandle -> IO () | ||
41 | quitListening (ServerHandle socket) = sClose socket | ||
42 | |||
38 | doServer addrfamily port g startCon = do | 43 | doServer addrfamily port g startCon = do |
39 | doServer' addrfamily port g startCon | 44 | doServer' addrfamily port g startCon |
40 | 45 | ||
@@ -68,7 +73,7 @@ doServer' family port g startCon = runServer2 port (runConn2 g) | |||
68 | forkIO $ do | 73 | forkIO $ do |
69 | mainLoop sock (ConnId 0) go | 74 | mainLoop sock (ConnId 0) go |
70 | -- L.putStrLn $ "quit accept loop" | 75 | -- L.putStrLn $ "quit accept loop" |
71 | return sock | 76 | return (ServerHandle sock) |
72 | where | 77 | where |
73 | mainLoop sock idnum@(ConnId n) go = do | 78 | mainLoop sock idnum@(ConnId n) go = do |
74 | let doException ioerror = do | 79 | let doException ioerror = do |