From a84e717eecf2dda8221a8aa8569148c01f2505b0 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 19 Sep 2013 05:21:33 +0200 Subject: property_list_service: handle timeout condition on receive this adds the new error code PROPERTY_LIST_SERVICE_E_TIMEOUT that occurs if the given timeout is reached when trying to receive data. --- src/property_list_service.c | 5 ++++- src/property_list_service.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/property_list_service.c b/src/property_list_service.c index f1c3f86..28739c7 100644 --- a/src/property_list_service.c +++ b/src/property_list_service.c @@ -223,7 +223,10 @@ static property_list_service_error_t internal_plist_receive_timeout(property_lis return PROPERTY_LIST_SERVICE_E_INVALID_ARG; } - service_receive_with_timeout(client->parent, (char*)&pktlen, sizeof(pktlen), &bytes, timeout); + service_error_t serr = service_receive_with_timeout(client->parent, (char*)&pktlen, sizeof(pktlen), &bytes, timeout); + if ((serr == SERVICE_E_SUCCESS) && (bytes == 0)) { + return PROPERTY_LIST_SERVICE_E_TIMEOUT; + } debug_info("initial read=%i", bytes); if (bytes < 4) { debug_info("initial read failed!"); diff --git a/src/property_list_service.h b/src/property_list_service.h index c18fd76..84053e0 100644 --- a/src/property_list_service.h +++ b/src/property_list_service.h @@ -32,6 +32,7 @@ #define PROPERTY_LIST_SERVICE_E_PLIST_ERROR -2 #define PROPERTY_LIST_SERVICE_E_MUX_ERROR -3 #define PROPERTY_LIST_SERVICE_E_SSL_ERROR -4 +#define PROPERTY_LIST_SERVICE_E_TIMEOUT -5 #define PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR -256 -- cgit v1.1-32-gdbae