diff options
author | joe <joe@jerkface.net> | 2014-02-11 20:48:34 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2014-02-11 20:48:34 -0500 |
commit | df8038e9c7341ef470318aaafe517074aa553349 (patch) | |
tree | ab8c75a7d2f5c6baecf0701a3372cb8a86a3247f /Presence/Server.hs | |
parent | 44cc78636b564d479d76be989fbb36fd1e720e10 (diff) |
Switched to throw-to instead of hClose to quit reader thread
Diffstat (limited to 'Presence/Server.hs')
-rw-r--r-- | Presence/Server.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Presence/Server.hs b/Presence/Server.hs index 1d586900..e5ceaf2d 100644 --- a/Presence/Server.hs +++ b/Presence/Server.hs | |||
@@ -482,8 +482,8 @@ connectionThreads h pinglogic = do | |||
482 | let finished e = do | 482 | let finished e = do |
483 | hClose h | 483 | hClose h |
484 | -- warn $ "finished read: " <> bshow (fmap ioeGetErrorType e) | 484 | -- warn $ "finished read: " <> bshow (fmap ioeGetErrorType e) |
485 | let _ = fmap ioeGetErrorType e -- type hint | 485 | -- let _ = fmap ioeGetErrorType e -- type hint |
486 | -- let _ = fmap what e where what (SomeException _) = undefined | 486 | let _ = fmap what e where what (SomeException _) = undefined |
487 | atomically $ do tryTakeTMVar outs | 487 | atomically $ do tryTakeTMVar outs |
488 | putTMVar outs Nothing -- quit writer | 488 | putTMVar outs Nothing -- quit writer |
489 | putTMVar doner () | 489 | putTMVar doner () |
@@ -498,8 +498,8 @@ connectionThreads h pinglogic = do | |||
498 | 498 | ||
499 | writerThread <- forkIO . fix $ \loop -> do | 499 | writerThread <- forkIO . fix $ \loop -> do |
500 | let finished = do -- warn $ "finished write" | 500 | let finished = do -- warn $ "finished write" |
501 | hClose h -- quit reader | 501 | -- hClose h -- quit reader |
502 | -- throwTo readerThread (ErrorCall "EOF") | 502 | throwTo readerThread (ErrorCall "EOF") |
503 | atomically $ putTMVar donew () | 503 | atomically $ putTMVar donew () |
504 | mb <- atomically $ readTMVar outs | 504 | mb <- atomically $ readTMVar outs |
505 | case mb of Just bs -> handle (\(SomeException e)->finished) | 505 | case mb of Just bs -> handle (\(SomeException e)->finished) |