summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-11-28 17:00:45 +0100
committerGravatar Martin Szulecki2011-03-26 11:52:02 +0100
commitf55a7dd55b4ace31a21916ce1e76a7f5fd9c0cc3 (patch)
treeb2168df3a5776f9fe9e979a49670ebc65726556e
parentfb472d7749dd328cf5ec7360cb8831d2f510a92b (diff)
downloadlibimobiledevice-f55a7dd55b4ace31a21916ce1e76a7f5fd9c0cc3.tar.gz
libimobiledevice-f55a7dd55b4ace31a21916ce1e76a7f5fd9c0cc3.tar.bz2
notification_proxy: read ProxyDeath message after posting notification
This prevents ugly error messages appearing in the device's syslog.
-rw-r--r--src/notification_proxy.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/notification_proxy.c b/src/notification_proxy.c
index c0f718e..80a82c4 100644
--- a/src/notification_proxy.c
+++ b/src/notification_proxy.c
@@ -178,6 +178,27 @@ np_error_t np_post_notification(np_client_t client, const char *notification)
debug_info("Error sending XML plist to device!");
}
+ // try to read an answer, we just ignore errors here
+ dict = NULL;
+ property_list_service_receive_plist(client->parent, &dict);
+ if (dict) {
+#ifndef STRIP_DEBUG_CODE
+ char *cmd_value = NULL;
+ plist_t cmd_value_node = plist_dict_get_item(dict, "Command");
+ if (plist_get_node_type(cmd_value_node) == PLIST_STRING) {
+ plist_get_string_val(cmd_value_node, &cmd_value);
+ }
+
+ if (cmd_value && !strcmp(cmd_value, "ProxyDeath")) {
+ // this is the expected answer
+ } else {
+ debug_plist(dict);
+ }
+ g_free(cmd_value);
+#endif
+ plist_free(dict);
+ }
+
np_unlock(client);
return res;
}