summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Presence/Server.hs12
-rw-r--r--Presence/XMPPServer.hs21
2 files changed, 16 insertions, 17 deletions
diff --git a/Presence/Server.hs b/Presence/Server.hs
index fd5f1e43..f7f99907 100644
--- a/Presence/Server.hs
+++ b/Presence/Server.hs
@@ -3,9 +3,7 @@
3{-# LANGUAGE StandaloneDeriving #-} 3{-# LANGUAGE StandaloneDeriving #-}
4{-# LANGUAGE OverloadedStrings #-} 4{-# LANGUAGE OverloadedStrings #-}
5{-# LANGUAGE TupleSections #-} 5{-# LANGUAGE TupleSections #-}
6#ifdef TEST
7{-# LANGUAGE FlexibleInstances #-} 6{-# LANGUAGE FlexibleInstances #-}
8#endif
9----------------------------------------------------------------------------- 7-----------------------------------------------------------------------------
10-- | 8-- |
11-- Module : Server 9-- Module : Server
@@ -15,7 +13,7 @@
15-- 13--
16-- A TCP client/server library. 14-- A TCP client/server library.
17-- 15--
18-- TODO: 16-- TODO: XXX: A newer version of this code is in the server.git repo. XXX
19-- 17--
20-- * interface tweaks 18-- * interface tweaks
21-- 19--
@@ -163,9 +161,9 @@ data ConnectionEvent b
163 -- ^ A 'Connect' command failed. 161 -- ^ A 'Connect' command failed.
164 | HalfConnection InOrOut 162 | HalfConnection InOrOut
165 -- ^ Half of a half-duplex connection is avaliable. 163 -- ^ Half of a half-duplex connection is avaliable.
166 | EOF 164 | EOF
167 -- ^ A connection was terminated 165 -- ^ A connection was terminated
168 | RequiresPing 166 | RequiresPing
169 -- ^ 'pingInterval' miliseconds of idle was experienced 167 -- ^ 'pingInterval' miliseconds of idle was experienced
170 168
171#ifdef TEST 169#ifdef TEST
@@ -187,7 +185,7 @@ data ConnectionRecord u
187 185
188-- | This object accepts commands and signals events and maintains 186-- | This object accepts commands and signals events and maintains
189-- the list of currently listening ports and established connections. 187-- the list of currently listening ports and established connections.
190data Server a u 188data Server a u
191 = Server { serverCommand :: TMVar (ServerInstruction a u) 189 = Server { serverCommand :: TMVar (ServerInstruction a u)
192 , serverEvent :: TChan ((a,u), ConnectionEvent ByteString) 190 , serverEvent :: TChan ((a,u), ConnectionEvent ByteString)
193 , serverReleaseKey :: ReleaseKey 191 , serverReleaseKey :: ReleaseKey
@@ -447,7 +445,7 @@ newConnection server params conkey u h inout = do
447 getkont <- atomically $ takeTMVar kontvar 445 getkont <- atomically $ takeTMVar kontvar
448 kont <- atomically getkont 446 kont <- atomically getkont
449 kont 447 kont
450 448
451 atomically $ do 449 atomically $ do
452 current <- fmap (Map.lookup conkey) $ readTVar (conmap server) 450 current <- fmap (Map.lookup conkey) $ readTVar (conmap server)
453 case current of 451 case current of
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs
index 272594e7..41d60a07 100644
--- a/Presence/XMPPServer.hs
+++ b/Presence/XMPPServer.hs
@@ -26,8 +26,19 @@ module XMPPServer
26 , makeRosterUpdate 26 , makeRosterUpdate
27 , makeMessage 27 , makeMessage
28 , JabberShow(..) 28 , JabberShow(..)
29 , Server
29 ) where 30 ) where
30 31
32import ConnectionKey
33import qualified Control.Concurrent.STM.UpdateStream as Slotted
34import Nesting
35import Server
36import EventUtil
37import ControlMaybe
38import LockedChan
39import PeerResolve
40import Blaze.ByteString.Builder (Builder)
41
31import Debug.Trace 42import Debug.Trace
32import System.IO (hFlush,stdout) 43import System.IO (hFlush,stdout)
33import Control.Monad.Trans.Resource 44import Control.Monad.Trans.Resource
@@ -70,16 +81,6 @@ import Data.Void (Void)
70import System.Endian (toBE32) 81import System.Endian (toBE32)
71import Control.Applicative 82import Control.Applicative
72 83
73import ConnectionKey
74import qualified Control.Concurrent.STM.UpdateStream as Slotted
75import Nesting
76import Server
77import EventUtil
78import ControlMaybe
79import LockedChan
80import PeerResolve
81import Blaze.ByteString.Builder (Builder)
82
83peerport :: PortNumber 84peerport :: PortNumber
84peerport = 5269 85peerport = 5269
85clientport :: PortNumber 86clientport :: PortNumber