Skip to content

Server never quits on windows #288

@sopvop

Description

@sopvop

This happens because on windows listen is always blocking. The common workaround is to fork server in separate thread and use N.close on exit.

Like with this workaround:

import Network.Socket  qualified as N

withGrpc :: Server -> (RunningServer -> IO a) -> IO a
withGrpc handlers  act =
  forkServer def config serv $ \server -> do
    sock <- atomically $ getInsecureSocket server
    act server `finally` N.close sock

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions