[epiphany/wip/ephy-sync] sync-bookmarks: Function to log all the info from the server. Function to warn about failures
- From: Gabriel - Cristian Ivascu <gabrielivascu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/ephy-sync] sync-bookmarks: Function to log all the info from the server. Function to warn about failures
- Date: Mon, 8 Aug 2016 18:23:43 +0000 (UTC)
commit 6be6afca9f1026c126e3cc4dc70860a8c650aa1f
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Mon Aug 8 21:13:20 2016 +0300
sync-bookmarks: Function to log all the info from the server. Function to warn about failures
src/ephy-sync-bookmarks.c | 55 ++++++++++++++++++++++++++++++--------------
1 files changed, 37 insertions(+), 18 deletions(-)
---
diff --git a/src/ephy-sync-bookmarks.c b/src/ephy-sync-bookmarks.c
index 9344b72..4d7d340 100644
--- a/src/ephy-sync-bookmarks.c
+++ b/src/ephy-sync-bookmarks.c
@@ -27,6 +27,31 @@
#define EPHY_BOOKMARKS_COLLECTION "ephy-bookmarks"
static void
+log_all_message_info (const gchar *text,
+ SoupMessage *message)
+{
+ LOG ("%s:", text);
+ LOG ("status_code: %u", message->status_code);
+ LOG ("response_body: %s", message->response_body->data);
+ LOG ("Retry-After: %s", soup_message_headers_get_one (message->response_headers, "Retry-After"));
+ LOG ("X-Weave-Backoff: %s", soup_message_headers_get_one (message->response_headers, "X-Weave-Backoff"));
+ LOG ("X-Last-Modified: %s", soup_message_headers_get_one (message->response_headers, "X-Last-Modified"));
+ LOG ("X-Weave-Timestamp: %s", soup_message_headers_get_one (message->response_headers,
"X-Weave-Timestamp"));
+ LOG ("X-Weave-Records: %s", soup_message_headers_get_one (message->response_headers, "X-Weave-Records"));
+ LOG ("X-Weave-Next-Offset: %s", soup_message_headers_get_one (message->response_headers,
"X-Weave-Next-Offset"));
+ LOG ("X-Weave-Quota-Remaining: %s", soup_message_headers_get_one (message->response_headers,
"X-Weave-Quota-Remaining"));
+ LOG ("X-Weave-Alert: %s", soup_message_headers_get_one (message->response_headers, "X-Weave-Alert"));
+}
+
+static void
+warning_alert (const gchar *text,
+ SoupMessage *message)
+{
+ g_warning ("%s. Status code: %u, response: %s",
+ text, message->status_code, message->response_body->data);
+}
+
+static void
create_bso_collection_response_cb (SoupSession *session,
SoupMessage *message,
gpointer user_data)
@@ -40,8 +65,7 @@ create_bso_collection_response_cb (SoupSession *session,
* anyway, we don't treat this as an error.
*/
if (message->status_code != 200 && message->status_code != 412) {
- g_warning ("Failed to add dummy BSO to collection, status code: %u, response: %s",
- message->status_code, message->response_body->data);
+ warning_alert ("Failed to add dummy BSO to collection", message);
return;
}
@@ -78,21 +102,16 @@ ephy_sync_bookmarks_create_storage_collection (void)
}
static void
-server_response_default_cb (SoupSession *session,
- SoupMessage *message,
- gpointer user_data)
+storage_server_response_default_cb (SoupSession *session,
+ SoupMessage *message,
+ gpointer user_data)
{
- LOG ("Server response:");
- LOG ("status_code: %u", message->status_code);
- LOG ("response_body: %s", message->response_body->data);
- LOG ("Retry-After: %s", soup_message_headers_get_one (message->response_headers, "Retry-After"));
- LOG ("X-Weave-Backoff: %s", soup_message_headers_get_one (message->response_headers, "X-Weave-Backoff"));
- LOG ("X-Last-Modified: %s", soup_message_headers_get_one (message->response_headers, "X-Last-Modified"));
- LOG ("X-Weave-Timestamp: %s", soup_message_headers_get_one (message->response_headers,
"X-Weave-Timestamp"));
- LOG ("X-Weave-Records: %s", soup_message_headers_get_one (message->response_headers, "X-Weave-Records"));
- LOG ("X-Weave-Next-Offset: %s", soup_message_headers_get_one (message->response_headers,
"X-Weave-Next-Offset"));
- LOG ("X-Weave-Quota-Remaining: %s", soup_message_headers_get_one (message->response_headers,
"X-Weave-Quota-Remaining"));
- LOG ("X-Weave-Alert: %s", soup_message_headers_get_one (message->response_headers, "X-Weave-Alert"));
+ EphySyncService *service;
+
+ log_all_message_info ("storage_server_response_default_cb", message);
+
+ service = ephy_shell_get_global_sync_service (ephy_shell_get_default ());
+ ephy_sync_service_release_next_storage_message (service);
}
void
@@ -105,7 +124,7 @@ ephy_sync_bookmarks_check_storage_collection (void)
endpoint = g_strdup_printf ("storage/%s", EPHY_BOOKMARKS_COLLECTION);
ephy_sync_service_send_storage_message (service, endpoint,
SOUP_METHOD_GET, NULL, -1, -1,
- server_response_default_cb, NULL);
+ storage_server_response_default_cb, NULL);
g_free (endpoint);
}
@@ -119,6 +138,6 @@ ephy_sync_bookmarks_delete_storage_collection (void)
endpoint = g_strdup_printf ("storage/%s", EPHY_BOOKMARKS_COLLECTION);
ephy_sync_service_send_storage_message (service, endpoint,
SOUP_METHOD_DELETE, NULL, -1, -1,
- server_response_default_cb, NULL);
+ storage_server_response_default_cb, NULL);
g_free (endpoint);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]