Skip to content
Snippets Groups Projects
Commit 712f37af authored by Jens Nolte's avatar Jens Nolte
Browse files

Update quasar

parent ffa4083e
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ import Quasar.Wayland.Client ...@@ -7,7 +7,7 @@ import Quasar.Wayland.Client
main :: IO () main :: IO ()
main = do main = do
withResourceManagerM do withRootResourceManager do
traceIO "Connecting" traceIO "Connecting"
client <- connectWaylandClient client <- connectWaylandClient
traceIO "Connected" traceIO "Connected"
......
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
}, },
"locked": { "locked": {
"host": "git.c3pb.de", "host": "git.c3pb.de",
"lastModified": 1631852696, "lastModified": 1638315058,
"narHash": "sha256-sM5h2IHVyB0kKMNz44042D6QVvsTyUhaOCYkdcEjabQ=", "narHash": "sha256-SA99IShGlTc3IkcqG5YP/lnSyTWWHFIdvci5pWR8BrI=",
"owner": "jens", "owner": "jens",
"repo": "quasar", "repo": "quasar",
"rev": "862976c067cc41435e1087def16dfb86c57b317b", "rev": "7f163062fd2dc98041b5149c5ab23fd8cedde7e6",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
}, },
"locked": { "locked": {
"host": "git.c3pb.de", "host": "git.c3pb.de",
"lastModified": 1631899417, "lastModified": 1638330205,
"narHash": "sha256-qSD1O3x/oCgrm6v1GGSO2d+rO0jMs2zi8yASXhPyHN0=", "narHash": "sha256-vVdNLDtS7mmj5FLJ7/lL0mJ9r05ZLhJQoRAlmDa7OC4=",
"owner": "jens", "owner": "jens",
"repo": "quasar-network", "repo": "quasar-network",
"rev": "fda985686d4003c85c53bbb1654cf5324ae4e7c2", "rev": "12c98e410f4a6d96b9ea2390da1edc6d026ad7ae",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
......
...@@ -51,18 +51,16 @@ newWaylandConnection initializeProtocolAction socket = do ...@@ -51,18 +51,16 @@ newWaylandConnection initializeProtocolAction socket = do
registerDisposeAction $ closeConnection connection registerDisposeAction $ closeConnection connection
runUnlimitedAsync do connectionThread connection $ sendThread connection
connectionThread connection $ sendThread connection connectionThread connection $ receiveThread connection
connectionThread connection $ receiveThread connection
pure (result, connection) pure (result, connection)
connectionThread :: MonadAsync m => WaylandConnection s -> IO () -> m () connectionThread :: MonadResourceManager m => WaylandConnection s -> IO () -> m ()
connectionThread connection work = async_ $ liftIO $ work `catches` [ignoreCancelTask, traceAndDisposeConnection] connectionThread connection work = asyncWithHandler_ traceAndDisposeConnection $ liftIO $ work
where where
ignoreCancelTask :: Handler IO a traceAndDisposeConnection :: SomeException -> IO ()
ignoreCancelTask = Handler (throwM :: CancelTask -> IO a) traceAndDisposeConnection ex = traceIO (displayException ex) >> void (dispose connection)
traceAndDisposeConnection = Handler (\(ex :: SomeException) -> traceIO (displayException ex) >> void (dispose connection))
sendThread :: WaylandConnection s -> IO () sendThread :: WaylandConnection s -> IO ()
sendThread connection = forever do sendThread connection = forever do
...@@ -83,8 +81,5 @@ receiveThread connection = forever do ...@@ -83,8 +81,5 @@ receiveThread connection = forever do
feedInput connection.protocolHandle bytes feedInput connection.protocolHandle bytes
closeConnection :: WaylandConnection s -> IO (Awaitable ()) closeConnection :: WaylandConnection s -> IO ()
closeConnection connection = do closeConnection connection = Socket.close connection.socket
-- gracefulClose may fail but guarantees that the socket is deallocated
Socket.close connection.socket `catch` \(_ :: SomeException) -> pure ()
pure $ pure ()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment