From cdc41b66d21e4758d22d9cbc0e8ce84bc79ce95f Mon Sep 17 00:00:00 2001 From: dequis Date: Wed, 12 Jul 2017 15:37:09 -0300 Subject: Fix login hang/timeout when the last page of contacts is empty The contact list is fetched in pages of 500, but non-friends need to be filtered out, so you could end up in a situation where the last page of results is all non-friends. The "contacts" signal was emitted for each page of results, and has a flag that says if it's complete, which lets login continue. So when the last page of the contact list is empty (all non-friends) the contacts signal isn't emitted, and login gets stuck forever. This commit changes it so that the signal is emitted with an empty 'users' GSList when it's complete (and when it's an initial fetch, not when when parsing deltas, which doesn't use the 'users' GSList) Thanks to dcxk for finding this and helping debug it. --- facebook/facebook-api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'facebook/facebook-api.c') diff --git a/facebook/facebook-api.c b/facebook/facebook-api.c index a72f386..4661ef4 100644 --- a/facebook/facebook-api.c +++ b/facebook/facebook-api.c @@ -2389,7 +2389,7 @@ fb_api_cb_contacts(FbHttpRequest *req, gpointer data) priv->contacts_delta = g_strdup(is_delta ? cursor : delta_cursor); } - if (users) { + if (users || (complete && !is_delta)) { g_signal_emit_by_name(api, "contacts", users, complete); } -- cgit v1.2.3 From e460983b98aa29c222b3990c41c16355d8fe78a1 Mon Sep 17 00:00:00 2001 From: dequis Date: Wed, 30 Aug 2017 19:54:54 -0300 Subject: Fix "Failed to read thrift" with unknown fields in /t_p payload >Login error: Failed to read thrift: facebook-api.c:1815 >fb_api_cb_publish_pt: assertion 'FALSE' failed --- facebook/facebook-api.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'facebook/facebook-api.c') diff --git a/facebook/facebook-api.c b/facebook/facebook-api.c index 4661ef4..fb0581d 100644 --- a/facebook/facebook-api.c +++ b/facebook/facebook-api.c @@ -1853,8 +1853,18 @@ fb_api_cb_publish_pt(FbThrift *thft, GSList **press, GError **error) FB_API_TCHK(fb_thrift_read_i64(thft, NULL)); break; + case 6: + /* Unknown new field */ + FB_API_TCHK(type == FB_THRIFT_TYPE_I64); + FB_API_TCHK(fb_thrift_read_i64(thft, NULL)); + break; + default: - FB_API_TCHK(FALSE); + /* Try to read unknown fields as varint */ + FB_API_TCHK(type == FB_THRIFT_TYPE_I16 || + type == FB_THRIFT_TYPE_I32 || + type == FB_THRIFT_TYPE_I64); + FB_API_TCHK(fb_thrift_read_i64(thft, NULL)); break; } } -- cgit v1.2.3