- 02 Sep, 2024 1 commit
-
-
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.
-
- 30 Aug, 2024 1 commit
-
-
Przemyslaw Kaminski authored
-
- 17 Jun, 2024 2 commits
-
-
Przemyslaw Kaminski authored
This makes it easier to change protocols, ports etc.
-
Przemyslaw Kaminski authored
-
- 05 Jun, 2024 1 commit
-
-
Przemyslaw Kaminski authored
-
- 29 May, 2024 1 commit
-
-
Przemyslaw Kaminski authored
Also, will use stm containers
-
- 25 May, 2024 1 commit
-
-
Przemyslaw Kaminski authored
-
- 23 May, 2024 1 commit
-
-
Przemyslaw Kaminski authored
I'm currently able to do the following: - start gargantext-server (as it hosts central exchange and dispatcher, currently) - start a websocket connection: websocat ws://localhost:8008/ws - subscibe to a topic (in websocat): {"request": "subscribe", "topic": {"type": "update_tree", "node_id": 15}} - optionally subscibe to other node_ids or start other websocat's with different subscriptions (can be multiple) - fire up cabal v2-run gargantext-central-exchange -- client This triggers a node_id: 15 and node_id: 16 notification to be sent You can send your own notifications, e.g. with Python: import json import nanomsg as n s = n.Socket(n.PUSH) s.connect('tcp://localhost:5560') s.send(json.dumps({'type': 'update_tree_first_level', 'node_id': 15}))
-
- 22 May, 2024 1 commit
-
-
Przemyslaw Kaminski authored
-