summaryrefslogtreecommitdiff
path: root/Presence/Server.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Presence/Server.hs')
-rw-r--r--Presence/Server.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Presence/Server.hs b/Presence/Server.hs
index e5ceaf2d..4cbaaa7d 100644
--- a/Presence/Server.hs
+++ b/Presence/Server.hs
@@ -145,6 +145,8 @@ data ConnectionEvent b
145 -- ^ Arrival of data from a socket 145 -- ^ Arrival of data from a socket
146 | Connection (STM Bool) (IO (Maybe ByteString)) (ByteString -> IO Bool) 146 | Connection (STM Bool) (IO (Maybe ByteString)) (ByteString -> IO Bool)
147 -- ^ A new connection was established 147 -- ^ A new connection was established
148 | ConnectFailure SockAddr
149 -- ^ A 'Connect' command failed.
148 | HalfConnection InOrOut 150 | HalfConnection InOrOut
149 -- ^ Half of a half-duplex connection is avaliable. 151 -- ^ Half of a half-duplex connection is avaliable.
150 | EOF 152 | EOF
@@ -267,7 +269,14 @@ server = do
267 proto <- getProtocolNumber "tcp" 269 proto <- getProtocolNumber "tcp"
268 sock <- bracketOnError 270 sock <- bracketOnError
269 (socket (socketFamily addr) Stream proto) 271 (socket (socketFamily addr) Stream proto)
270 (sClose . trace "connect-error" ) -- only done if there's an error 272 (\sock -> do -- only done if there's an error
273 -- Weird hack: puting the would-be peer address
274 -- instead of local socketName
275 conkey <- makeConnKey params (sock,addr) -- XXX: ?
276 sClose sock
277 atomically
278 $ writeTChan (serverEvent server)
279 $ (conkey,ConnectFailure addr))
271 $ \sock -> do connect sock addr 280 $ \sock -> do connect sock addr
272 return sock 281 return sock
273 me <- getSocketName sock 282 me <- getSocketName sock