diff options
-rw-r--r-- | Presence/Server.hs | 12 | ||||
-rw-r--r-- | Presence/XMPPServer.hs | 21 |
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. |
190 | data Server a u | 188 | data 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 | ||
32 | import ConnectionKey | ||
33 | import qualified Control.Concurrent.STM.UpdateStream as Slotted | ||
34 | import Nesting | ||
35 | import Server | ||
36 | import EventUtil | ||
37 | import ControlMaybe | ||
38 | import LockedChan | ||
39 | import PeerResolve | ||
40 | import Blaze.ByteString.Builder (Builder) | ||
41 | |||
31 | import Debug.Trace | 42 | import Debug.Trace |
32 | import System.IO (hFlush,stdout) | 43 | import System.IO (hFlush,stdout) |
33 | import Control.Monad.Trans.Resource | 44 | import Control.Monad.Trans.Resource |
@@ -70,16 +81,6 @@ import Data.Void (Void) | |||
70 | import System.Endian (toBE32) | 81 | import System.Endian (toBE32) |
71 | import Control.Applicative | 82 | import Control.Applicative |
72 | 83 | ||
73 | import ConnectionKey | ||
74 | import qualified Control.Concurrent.STM.UpdateStream as Slotted | ||
75 | import Nesting | ||
76 | import Server | ||
77 | import EventUtil | ||
78 | import ControlMaybe | ||
79 | import LockedChan | ||
80 | import PeerResolve | ||
81 | import Blaze.ByteString.Builder (Builder) | ||
82 | |||
83 | peerport :: PortNumber | 84 | peerport :: PortNumber |
84 | peerport = 5269 | 85 | peerport = 5269 |
85 | clientport :: PortNumber | 86 | clientport :: PortNumber |