summaryrefslogtreecommitdiff
path: root/Connection/Tcp.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-05-22 01:40:28 -0400
committerjoe <joe@jerkface.net>2018-05-22 01:40:28 -0400
commitb56fb7874cda7799b2535dee81a32dcedb09c676 (patch)
treef74e9c71e2f69cb8d97ed4d4ffad5a884d755425 /Connection/Tcp.hs
parent1661192a9c84ceaad6d372bd80820a7066fa1e10 (diff)
Configurable bind-addresses for xmpp.
Diffstat (limited to 'Connection/Tcp.hs')
-rw-r--r--Connection/Tcp.hs17
1 files changed, 6 insertions, 11 deletions
diff --git a/Connection/Tcp.hs b/Connection/Tcp.hs
index 01e0f473..2c2c8d76 100644
--- a/Connection/Tcp.hs
+++ b/Connection/Tcp.hs
@@ -139,16 +139,16 @@ data ServerInstruction conkey u
139 = Quit 139 = Quit
140 -- ^ kill the server. This command is automatically issued when 140 -- ^ kill the server. This command is automatically issued when
141 -- the server is released. 141 -- the server is released.
142 | Listen PortNumber (ConnectionParameters conkey u) 142 | Listen SockAddr (ConnectionParameters conkey u)
143 -- ^ listen for incoming connections 143 -- ^ listen for incoming connections on the given bind address.
144 | Connect SockAddr (ConnectionParameters conkey u) 144 | Connect SockAddr (ConnectionParameters conkey u)
145 -- ^ connect to addresses 145 -- ^ connect to addresses
146 | ConnectWithEndlessRetry SockAddr 146 | ConnectWithEndlessRetry SockAddr
147 (ConnectionParameters conkey u) 147 (ConnectionParameters conkey u)
148 Miliseconds 148 Miliseconds
149 -- ^ keep retrying the connection 149 -- ^ keep retrying the connection
150 | Ignore PortNumber 150 | Ignore SockAddr
151 -- ^ stop listening on specified port 151 -- ^ stop listening on specified bind address
152 | Send conkey ByteString 152 | Send conkey ByteString
153 -- ^ send bytes to an established connection 153 -- ^ send bytes to an established connection
154 154
@@ -201,7 +201,7 @@ data Server a u releaseKey b
201 , serverEvent :: TChan ((a,u), ConnectionEvent b) 201 , serverEvent :: TChan ((a,u), ConnectionEvent b)
202 , serverReleaseKey :: releaseKey 202 , serverReleaseKey :: releaseKey
203 , conmap :: TVar (Map a (ConnectionRecord u)) 203 , conmap :: TVar (Map a (ConnectionRecord u))
204 , listenmap :: TVar (Map PortNumber ServerHandle) 204 , listenmap :: TVar (Map SockAddr ServerHandle)
205 , retrymap :: TVar (Map SockAddr (TVar Bool,InterruptibleDelay)) 205 , retrymap :: TVar (Map SockAddr (TVar Bool,InterruptibleDelay))
206 } 206 }
207 207
@@ -300,12 +300,7 @@ server allocate sessionConduits = do
300 300
301 hPutStrLn stderr $ "Started listening on "++show port 301 hPutStrLn stderr $ "Started listening on "++show port
302 302
303 let family = AF_INET6 303 sserv <- flip streamServer port ServerConfig
304 address = case family of
305 AF_INET -> SockAddrInet port iNADDR_ANY
306 AF_INET6 -> SockAddrInet6 port 0 iN6ADDR_ANY 0
307
308 sserv <- flip streamServer address ServerConfig
309 { serverWarn = hPutStrLn stderr 304 { serverWarn = hPutStrLn stderr
310 , serverSession = \sock _ h -> do 305 , serverSession = \sock _ h -> do
311 (conkey,u) <- makeConnKey params sock 306 (conkey,u) <- makeConnKey params sock