1. 04 Sep, 2024 5 commits
  2. 03 Sep, 2024 2 commits
  3. 02 Sep, 2024 5 commits
    • Alfredo Di Napoli's avatar
      ws: remove calls to recvMalloc · 15b732f5
      Alfredo Di Napoli authored
      Remove the calls to `recvMalloc` in favour of using the (patched) `recv`
      from the original nanomsg library, which shouldn't segfault anymore. The
      reason for using `recv` are a few, but mostly the fact that `recv` can
      allocated arbitrary-long payloads data (up to the 1MB limit) without an
      hardcoded limit like `recvMalloc` was imposing. Furthermore, `recv` does
      resource cleanup for us via `c_nn_freemsg`, whereas `recvMalloc` is not
      thread/exception safe. Consider the implementation:
      
      ```
      recvMalloc :: Receiver a => Socket a -> Int -> IO ByteString
      recvMalloc (Socket t sid) numBytes = do
        ptr <- mallocBytes numBytes
        -- receive by blocking the thread
        len <- c_nn_recv sid ptr (#const NN_MSG) 0 -- (#const NN_DONTWAIT)
        str <- C.packCStringLen (castPtr ptr, fromIntegral len)
        free ptr
        return str
      ```
      
      If any exception (synchronous or asynchronous) strikes _before_ the call
      to `free`, we would be leaking C memory.
      15b732f5
    • Alfredo Di Napoli's avatar
      ws: make Dispatcher abstract · 7c0d6ba0
      Alfredo Di Napoli authored
      The `Dispatcher` type is now opaque and not exported by
      `.AsyncUpdates.Dispatcher`, and it has been moved out of the `.Types`.
      
      This ensures that we can make the internal record fields private, and
      offer accessors for things like `terminateDispatcher`. This preserve
      information hiding and allows us to change the internal way of
      terminating a dispatcher (for example switching away from normal
      `forkIO` in favour of `async` & co) while not breaking client's code.
      7c0d6ba0
    • Alfredo Di Napoli's avatar
      ws: abstract with pattern in withNotifications · 65053486
      Alfredo Di Napoli authored
      This commit refactors the common pattern `bracket init deinit use` in
      `withNotifications` in `drivers.hspec.Main`, so that `withNotifications`
      in atomic and the user doesn't incur in the pattern of using the init
      and deinit functions independently from the `bracket`.
      
      To be faithful about what I preach, we should do the same for
      `startCoreNLPServer` and `stopCoreNLPServer`.
      65053486
    • Alfredo Di Napoli's avatar
      ws: tighten the dispatcher public API · c5336b22
      Alfredo Di Napoli authored
      This commit tightens up the public API exposed by the Dispatcher,
      for similar reasons as we had for the CentralExchange.
      c5336b22
    • Alfredo Di Napoli's avatar
      ws: tighten CentralExchange API · b09e6de2
      Alfredo Di Napoli authored
      This commit tigthen the public API for the `.CentralExchange` module,
      so that it's clear which are the exported (public) functions, and
      we do not leak the transport layer used by the central exchange
      b09e6de2
  4. 30 Aug, 2024 3 commits
  5. 29 Aug, 2024 8 commits
  6. 28 Aug, 2024 4 commits
  7. 26 Aug, 2024 5 commits
  8. 22 Aug, 2024 1 commit
  9. 20 Aug, 2024 2 commits
  10. 19 Aug, 2024 5 commits