chatmail / chatmail/core

Misleading docs for dc_jsonrpc_next_response

Open
#7,978 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
929
Forks
143
Avg merge
1d 20h
Merged PRs (30d)
53

Description

The docs for the cffi function `dc_jsonrpc_next_response` say:

https://github.com/chatmail/core/blob/80acc9d46720723f5971d1c38599c2c091f138df/deltachat-ffi/deltachat.h#L6004-L6005

This is misleading because `dc_jsonrpc_instance_t` holds an `Arc` on `Accounts`, so it cannot happen that the underlying `accounts_t` has been dropped.

This sentence in the docs also suggests that for a clean shutdown you can just `dc_accounts_unref` to somehow unblock `dc_jsonrpc_next_response` which would then return `NULL` to then exit a `dc_jsonrpc_next_response` polling loop. But as far as I understand this will not work, for a clean shutdown it is necessary to manually unblock `dc_jsonrpc_next_response` by sending some request (like `get_system_info`) and then manually break the polling loop (e.g. based on a `done` flag which has been set when initiating the shutdown).

I think even just removing these two lines from the docs would improve comprehensibility.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.