Fix STM blocking on connecting
When attempting to connect to an address that doesn't exist, startEuphConnection now doesn't result in a thread blocked by an STM transaction any more. It now throws a simple ConnectionFailed exception.
This commit is contained in:
parent
d818aba337
commit
2fd045d59b
1 changed files with 6 additions and 3 deletions
|
|
@ -107,13 +107,16 @@ startEuphConnection host room = do
|
|||
let euphCon = Connection locked sendQueue eventQueue
|
||||
void
|
||||
$ forkIO
|
||||
$ handle (handleException eventQueue)
|
||||
$ handle (handleIOException eventQueue)
|
||||
$ handle (handleHandshakeException eventQueue)
|
||||
$ WSS.runSecureClient host 443 ("/room/" ++ room ++ "/ws")
|
||||
$ recvClient euphCon
|
||||
return euphCon
|
||||
where
|
||||
handleException :: EventQueue -> WS.HandshakeException -> IO ()
|
||||
handleException qEvent _ = atomically $ writeTBQueue qEvent ConnectionFailed
|
||||
handleHandshakeException :: EventQueue -> WS.HandshakeException -> IO ()
|
||||
handleHandshakeException qEvent _ = atomically $ writeTBQueue qEvent ConnectionFailed
|
||||
handleIOException :: EventQueue -> IOException -> IO ()
|
||||
handleIOException qEvent _ = atomically $ writeTBQueue qEvent ConnectionFailed
|
||||
|
||||
{-
|
||||
- Send thread
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue