You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After digging into majn/telegram-purple#220 some more, I don't believe there to be a problem with memcmp of the query struct's however it does appear that there is a msg_id conflict because the tree comparison function treats msg_ids as unique, but they are only unique per DC (well, per-DC-session), as this is how generate_next_msg_id() creates them. Thus the comparison function should be something like:
static int cmp_query(struct query *a, struct query *b) {
int ret = 0;
ret = (a->msg_id - b->msg_id);
return (ret ? ret : (a->session_id - b->session_id));
}
In https://github.com/vysheng/tgl/blob/master/queries.c#L105-L106 the code says
To say that a
struct query
is unique based on the first 8 bytes (64 bits) of the struct, howeverstruct query
is defined at https://github.com/vysheng/tgl/blob/master/queries.h#L38 to beIs the intention to compare msg_id's for uniqueness? because
long long
is not guaranteed to be exactly 64-bit, only 'at least' 64-bit in size.Should this code instead be changed to something like
and could this be what is causing crashes in majn/telegram-purple#220
The text was updated successfully, but these errors were encountered: