tgl
tgl copied to clipboard
Wishlist: Propagate errors, don't just exit
Specifically, tglmp_on_start
(when no valid RSA keys were found) in mtproto-client.c:1305
As there's no feedback from tgl about whether loading the key worked or not, the wrapping application has to duplicate lots of checks (e.g. key size, exponent sanity, etc), which is brittle and unreliable.
Suggested resolutions:
-
tgl_set_rsa_key{,_direct}
return a "boolean", andtglmp_on_start
just asserts that at least one key exists (because then it would be a programmer error if it doesn't). -
tglmp_on_start
returns a "boolean" - both of the above
In an unrelated note, there's also rpc_execute
which makes a direct call to exit
(when an invalid state/response pair is detected) in mtproto-client.c:1207
.