Skip to content

Misleading docs for dc_jsonrpc_next_response #7978

@d2weber

Description

@d2weber

The docs for the cffi function dc_jsonrpc_next_response say:

core/deltachat-ffi/deltachat.h

Lines 6004 to 6005 in 80acc9d

* If NULL is returned, the accounts_t belonging to the jsonrpc instance is unref'd and no more events will come;
* in this case, free the jsonrpc instance using dc_jsonrpc_unref().

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.

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