summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-12-11 21:04:53 +0100
committerGravatar Nikias Bassen2013-12-11 21:04:53 +0100
commit090492d7dd0ee5b92ae6f814835ea2b8269265ac (patch)
tree85dc37bcc90fc26c1c705c2263e070fa8c3b4596 /src
parent82d1c578d7166c0ba08d8b27aeba6be6230f9691 (diff)
downloadlibusbmuxd-090492d7dd0ee5b92ae6f814835ea2b8269265ac.tar.gz
libusbmuxd-090492d7dd0ee5b92ae6f814835ea2b8269265ac.tar.bz2
default to proto v1 (plist) with fallback to binary-only
Diffstat (limited to 'src')
-rw-r--r--src/libusbmuxd.c16
1 files 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;
}