diff options
author | Nisarg Jhaveri | 2021-02-17 17:31:54 +0530 |
---|---|---|
committer | Nisarg Jhaveri | 2021-02-17 17:31:54 +0530 |
commit | 4837527745d98b9314eec1a250e2e13ce1ec3031 (patch) | |
tree | 0f2749367cde6b98e370bbd5231578f199c81002 | |
parent | 5ef9f5968012906b329c3de5fd5a5f9c5345dfa8 (diff) | |
download | libimobiledevice-4837527745d98b9314eec1a250e2e13ce1ec3031.tar.gz libimobiledevice-4837527745d98b9314eec1a250e2e13ce1ec3031.tar.bz2 |
Remove redundent `select` call from idevicedebugserverproxy.c
- Turns out `socket_receive` anyway internally calls `select` again. Use `socket_receive_timeout` instead.
- Remove logging for timeout in socket.c as well, it is not really an error condition
-rw-r--r-- | common/socket.c | 2 | ||||
-rw-r--r-- | tools/idevicedebugserverproxy.c | 11 |
2 files changed, 2 insertions, 11 deletions
diff --git a/common/socket.c b/common/socket.c index 354e6a4..99a96b1 100644 --- a/common/socket.c +++ b/common/socket.c @@ -1084,8 +1084,6 @@ int socket_check_fd(int fd, fd_mode fdm, unsigned int timeout) return -1; } } else if (sret == 0) { - if (verbose >= 2) - fprintf(stderr, "%s: timeout\n", __func__); return -ETIMEDOUT; } } while (eagain); diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c index 405a5a4..15e8deb 100644 --- a/tools/idevicedebugserverproxy.c +++ b/tools/idevicedebugserverproxy.c @@ -121,15 +121,8 @@ static void* connection_handler(void* data) int dtimeout = 1; while (!quit_flag) { - fd_set read_fds = fds; - struct timeval tv = { 0, 1000 }; - int ret_sel = select(client_fd+1, &read_fds, NULL, NULL, &tv); - if (ret_sel < 0) { - perror("select"); - break; - } - if (FD_ISSET(client_fd, &read_fds)) { - ssize_t n = socket_receive(client_fd, buf, bufsize); + ssize_t n = socket_receive_timeout(client_fd, buf, bufsize, 0, 1); + if (n != -ETIMEDOUT) { if (n < 0) { fprintf(stderr, "Failed to read from client fd: %s\n", strerror(-n)); break; |