summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2009-03-23 19:00:52 +0100
committerGravatar Nikias Bassen2009-03-23 19:00:52 +0100
commit659110808d9ceef21593baca51b2b11ae92b43a3 (patch)
treeed7599e5b7e3d88b1b346cc08212cf3c5e1f6ede /main.c
parent87957c6f9476655fee8512e46021b21db45c4018 (diff)
downloadusbmuxd-659110808d9ceef21593baca51b2b11ae92b43a3.tar.gz
usbmuxd-659110808d9ceef21593baca51b2b11ae92b43a3.tar.bz2
changed timeout in handleConnectRequest
renamed hello request to scan request
Diffstat (limited to 'main.c')
-rw-r--r--main.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/main.c b/main.c
index f08a196..76f5c20 100644
--- a/main.c
+++ b/main.c
@@ -282,7 +282,7 @@ static int usbmuxd_handleConnectResult(struct client_data *cdata)
}
} else {
result = 0;
- err = iphone_mux_recv_timeout(cdata->muxclient, buffer, maxlen, &rlen, 1000);
+ err = iphone_mux_recv_timeout(cdata->muxclient, buffer, maxlen, &rlen, 100);
if (err != 0) {
fprintf(stderr, "%s: encountered USB read error: %d\n", __func__, err);
usbmuxd_send_result(cdata->socket, cdata->tag, -err);
@@ -460,7 +460,7 @@ static void *usbmuxd_bulk_reader_thread(void *arg)
static void *usbmuxd_client_init_thread(void *arg)
{
struct client_data *cdata;
- struct usbmuxd_hello *hello = NULL;
+ struct usbmuxd_scan_request *s_req = NULL;
struct usbmuxd_device_info_request dev_info_req;
struct usbmuxd_connect_request *c_req = NULL;
@@ -487,25 +487,25 @@ static void *usbmuxd_client_init_thread(void *arg)
fprintf(stderr, "%s: started (fd=%d)\n", __func__, cdata->socket);
- if ((recv_len = usbmuxd_get_request(cdata->socket, (void**)&hello, 0)) <= 0) {
+ if ((recv_len = usbmuxd_get_request(cdata->socket, (void**)&s_req, 0)) <= 0) {
fprintf(stderr, "%s: No Hello packet received, error %s\n", __func__, strerror(errno));
goto leave;
}
- if ((recv_len == sizeof(struct usbmuxd_hello)) && (hello->header.length == sizeof(struct usbmuxd_hello))
- && (hello->header.reserved == 0) && (hello->header.type == USBMUXD_HELLO)) {
+ if ((recv_len == sizeof(struct usbmuxd_scan_request)) && (s_req->header.length == sizeof(struct usbmuxd_scan_request))
+ && (s_req->header.reserved == 0) && (s_req->header.type == USBMUXD_SCAN)) {
// send success response
fprintf(stderr, "%s: Got Hello packet!\n", __func__);
- usbmuxd_send_result(cdata->socket, hello->header.tag, 0);
- } else if ((recv_len == sizeof(struct usbmuxd_connect_request)) && (hello->header.type == USBMUXD_CONNECT)) {
- c_req = (struct usbmuxd_connect_request*)hello;
- hello = NULL;
+ usbmuxd_send_result(cdata->socket, s_req->header.tag, 0);
+ } else if ((recv_len == sizeof(struct usbmuxd_connect_request)) && (s_req->header.type == USBMUXD_CONNECT)) {
+ c_req = (struct usbmuxd_connect_request*)s_req;
+ s_req = NULL;
goto connect;
} else {
// send error response and exit
fprintf(stderr, "%s: Invalid Hello packet received.\n", __func__);
// TODO is this required?!
- usbmuxd_send_result(cdata->socket, hello->header.tag, EINVAL);
+ usbmuxd_send_result(cdata->socket, s_req->header.tag, EINVAL);
goto leave;
}
@@ -698,8 +698,8 @@ connect:
leave:
fprintf(stderr, "%s: terminating\n", __func__);
- if (hello) {
- free(hello);
+ if (s_req) {
+ free(s_req);
}
if (c_req) {
free(c_req);