diff options
author | dequis <dx@dxzone.com.ar> | 2016-06-02 21:04:50 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2016-06-02 21:04:50 -0300 |
commit | e094e5ac91f61d526cc12c0fc01709968c7a5d20 (patch) | |
tree | 385e85dc4afc274f8fa08436aa82235203200fca /facebook | |
parent | 4efa3977cdaa714738dd01c8f33c459a3a2b89d0 (diff) | |
download | bitlbee-facebook-e094e5ac91f61d526cc12c0fc01709968c7a5d20.tar.gz bitlbee-facebook-e094e5ac91f61d526cc12c0fc01709968c7a5d20.tar.bz2 bitlbee-facebook-e094e5ac91f61d526cc12c0fc01709968c7a5d20.tar.xz |
Prevent disconnections on 509 errors, "Invalid attachment id"
I'm still not sure about the origin of these errors (I suspect it's a
race condition between servers), but it's going to be fixed properly in
the future when the sync protocol is updated and doing HTTP requests to
get the attachment URL is no longer required (newer orca versions only
do HTTP requests to get the url of file attachments, everything else is
included in the MQTT stream)
Diffstat (limited to 'facebook')
-rw-r--r-- | facebook/facebook-api.c | 6 | ||||
-rw-r--r-- | facebook/facebook-api.h | 4 | ||||
-rw-r--r-- | facebook/facebook.c | 5 |
3 files changed, 13 insertions, 2 deletions
diff --git a/facebook/facebook-api.c b/facebook/facebook-api.c index b451fba..213937e 100644 --- a/facebook/facebook-api.c +++ b/facebook/facebook-api.c @@ -589,6 +589,12 @@ fb_api_json_chk(FbApi *api, gconstpointer data, gssize size, JsonNode **node) priv->token = NULL; } + /* 509 is used for "invalid attachment id" */ + if (code == 509) { + errc = FB_API_ERROR_NONFATAL; + success = FALSE; + } + str = fb_json_values_next_str(values, NULL); if ((g_strcmp0(str, "ERROR_QUEUE_NOT_FOUND") == 0) || diff --git a/facebook/facebook-api.h b/facebook/facebook-api.h index 2da2977..5e17e98 100644 --- a/facebook/facebook-api.h +++ b/facebook/facebook-api.h @@ -341,6 +341,7 @@ typedef struct _FbApiUser FbApiUser; * @FB_API_ERROR_GENERAL: General failure. * @FB_API_ERROR_AUTH: Authentication failure. * @FB_API_ERROR_QUEUE: Queue failure. + * @FB_API_ERROR_NONFATAL: Other non-fatal errors. * * The error codes for the #FB_API_ERROR domain. */ @@ -348,7 +349,8 @@ typedef enum { FB_API_ERROR_GENERAL, FB_API_ERROR_AUTH, - FB_API_ERROR_QUEUE + FB_API_ERROR_QUEUE, + FB_API_ERROR_NONFATAL } FbApiError; /** diff --git a/facebook/facebook.c b/facebook/facebook.c index 8c16eb0..da06d89 100644 --- a/facebook/facebook.c +++ b/facebook/facebook.c @@ -294,7 +294,10 @@ fb_cb_api_error(FbApi *api, GError *error, gpointer data) ic = fb_data_get_connection(fata); fb_util_debug_error("%s", error->message); imcb_error(ic, "%s", error->message); - imc_logout(ic, recon); + + if (!g_error_matches(error, FB_API_ERROR, FB_API_ERROR_NONFATAL)) { + imc_logout(ic, recon); + } } static void |