From 090492d7dd0ee5b92ae6f814835ea2b8269265ac Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 11 Dec 2013 21:04:53 +0100 Subject: default to proto v1 (plist) with fallback to binary-only --- src/libusbmuxd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c index a39a099..77b2f43 100644 --- a/src/libusbmuxd.c +++ b/src/libusbmuxd.c @@ -95,7 +95,11 @@ pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static int listenfd = -1; static int use_tag = 0; +#ifdef HAVE_PLIST +static int proto_version = 1; +#else static int proto_version = 0; +#endif /** * Finds a device info record by its handle. @@ -533,8 +537,8 @@ retry: UNLOCK; close_socket(sfd); #ifdef HAVE_PLIST - if ((res == RESULT_BADVERSION) && (proto_version != 1)) { - proto_version = 1; + if ((res == RESULT_BADVERSION) && (proto_version == 1)) { + proto_version = 0; goto retry; } #endif @@ -742,8 +746,8 @@ retry: UNLOCK; close_socket(sfd); #ifdef HAVE_PLIST - if ((res == RESULT_BADVERSION) && (proto_version != 1)) { - proto_version = 1; + if ((res == RESULT_BADVERSION) && (proto_version == 1)) { + proto_version = 0; goto retry; } #endif @@ -905,8 +909,8 @@ retry: connected = 1; } else { #ifdef HAVE_PLIST - if ((res == RESULT_BADVERSION) && (proto_version == 0)) { - proto_version = 1; + if ((res == RESULT_BADVERSION) && (proto_version == 1)) { + proto_version = 0; close_socket(sfd); goto retry; } -- cgit v1.1-32-gdbae