diff options
author | Nikias Bassen | 2009-06-20 04:29:23 +0200 |
---|---|---|
committer | Nikias Bassen | 2009-06-20 04:29:23 +0200 |
commit | 94d700159d010176a57640d6f59476aaf43875fc (patch) | |
tree | e215eab15d5857b7eb7ef82deebee73cc3cbc1eb /src/usbmux.c | |
parent | bb33ccdf06f261dca033d70772bc256c890c76f7 (diff) | |
download | usbmuxd-94d700159d010176a57640d6f59476aaf43875fc.tar.gz usbmuxd-94d700159d010176a57640d6f59476aaf43875fc.tar.bz2 |
hopefully fixed race condition on connection setup
Diffstat (limited to 'src/usbmux.c')
-rw-r--r-- | src/usbmux.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/usbmux.c b/src/usbmux.c index 87cdede..927928e 100644 --- a/src/usbmux.c +++ b/src/usbmux.c @@ -100,6 +100,8 @@ struct usbmux_client_int { int error; int cleanup; + + int connected; }; @@ -734,6 +736,7 @@ int usbmux_new_client(usbmux_device_t device, uint16_t src_port, add_connection(new_connection); new_connection->error = 0; new_connection->cleanup = 0; + new_connection->connected = 0; hton_header(new_connection->header); log_debug_msg("%s: send_to_device (%d --> %d)\n", __func__, ntohs(new_connection->header->sport), @@ -931,6 +934,8 @@ uint32_t append_receive_buffer(usbmux_client_t client, char *packet) sizeof(usbmux_tcp_header)) <= 0) { log_debug_msg("%s: error when pushing to usb...\n", __func__); + } else { + client->connected = 1; } // need to revert some of the fields back to host notation. ntoh_header(client->header); @@ -1253,3 +1258,11 @@ int usbmux_recv_timeout(usbmux_client_t client, char *data, return 0; } + +int usbmux_is_connected(usbmux_client_t client) +{ + if (!client) { + return 0; + } + return client->connected; +} |