summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2014-11-12 13:31:34 +0100
committerGravatar Nikias Bassen2014-11-12 13:31:34 +0100
commita5e57e872bb5be8b13d3497f2c07fff8a8e37f3f (patch)
treeaf7e129ba4668fbc91c9cf567027e517503725f9
parent23ecea077d8f22d9da5cae50df3e2ff3406fee90 (diff)
downloadusbmuxd-a5e57e872bb5be8b13d3497f2c07fff8a8e37f3f.tar.gz
usbmuxd-a5e57e872bb5be8b13d3497f2c07fff8a8e37f3f.tar.bz2
Revert "client: Make sure fd is writable before calling send() to avoid blocking"
This reverts commit 23ecea077d8f22d9da5cae50df3e2ff3406fee90.
-rw-r--r--src/client.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/client.c b/src/client.c
index 417ba35..268c8b9 100644
--- a/src/client.c
+++ b/src/client.c
@@ -30,7 +30,6 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <sys/select.h>
#include <sys/un.h>
#include <arpa/inet.h>
#include <pthread.h>
@@ -101,28 +100,12 @@ int client_read(struct mux_client *client, void *buffer, uint32_t len)
*/
int client_write(struct mux_client *client, void *buffer, uint32_t len)
{
- int sret = -1;
- fd_set fds;
- struct timeval to = {0, 0};
-
usbmuxd_log(LL_SPEW, "client_write fd %d buf %p len %d", client->fd, buffer, len);
if(client->state != CLIENT_CONNECTED) {
usbmuxd_log(LL_ERROR, "Attempted to write to client %d not in CONNECTED state", client->fd);
return -1;
}
-
- /* make sure fd is ready for writing */
- FD_ZERO(&fds);
- FD_SET(client->fd, &fds);
- sret = select(client->fd + 1, NULL, &fds, NULL, &to);
-
- /* only send data if the fd is ready */
- if (sret > 0) {
- sret = send(client->fd, buffer, len, 0);
- } else {
- usbmuxd_log(LL_ERROR, "ERROR: client_write: fd %d not ready for writing", client->fd);
- }
- return sret;
+ return send(client->fd, buffer, len, 0);
}
/**