com php-src: don't use timeout for the remote prompt, recv() will block until input arrives: phpdbg_cmd.c phpdbg_io.c
| From: | Bob Weinand | Date: | Sun, 19 Oct 2014 16:30:07 +0000 |
| Subject: | com php-src: don't use timeout for the remote prompt, recv() will block until input arrives: phpdbg_cmd.c phpdbg_io.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82537@lists.php.net to get a copy of this message | ||
Commit: 362c87f4b0aea6aa6b812259190f34259b592d80
Author: Anatol Belski <ab@php.net> Sun, 19 Oct 2014 18:30:07 +0200
Parents: 0acafba89d93ec58de44515e1a5041494d29ae89
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=362c87f4b0aea6aa6b812259190f34259b592d80
Log:
don't use timeout for the remote prompt, recv() will block until input arrives
Changed paths:
M phpdbg_cmd.c
M phpdbg_io.c
Diff:
diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c
index f4c2e17..94e8e4c 100644
--- a/phpdbg_cmd.c
+++ b/phpdbg_cmd.c
@@ -863,7 +863,7 @@ readline:
}
len += bytes;
/* XXX export the timeout through INI??*/
- } while ((bytes = phpdbg_mixed_read(PHPDBG_G(io)[PHPDBG_STDIN].fd, buf + len, PHPDBG_MAX_CMD -
len, 30000)) > 0 || (errno == EINTR && bytes < 0));
+ } while ((bytes = phpdbg_mixed_read(PHPDBG_G(io)[PHPDBG_STDIN].fd, buf + len, PHPDBG_MAX_CMD -
len, -1)) > 0 || (errno == EINTR && bytes < 0));
if (bytes <= 0) {
goto disconnect;
diff --git a/phpdbg_io.c b/phpdbg_io.c
index 2dc6884..437e3ec 100644
--- a/phpdbg_io.c
+++ b/phpdbg_io.c
@@ -60,6 +60,7 @@ phpdbg_consume_bytes(int sock, char *ptr, int len, int tmo)
struct pollfd pfd;
TSRMLS_FETCH();
+ if (tmo < 0) goto recv_once;
pfd.fd = sock;
pfd.events = POLLIN;
@@ -71,6 +72,7 @@ phpdbg_consume_bytes(int sock, char *ptr, int len, int tmo)
struct timeval ttmo;
TSRMLS_FETCH();
+ if (tmo < 0) goto recv_once;
FD_ZERO(&readfds);
FD_SET(sock, &readfds);
@@ -84,11 +86,14 @@ phpdbg_consume_bytes(int sock, char *ptr, int len, int tmo)
return -1;
}
+recv_once:
while(i > 0) {
- /* There's something to read. Read what's available and proceed
- disregarding whether len could be exhausted or not.*/
- int can_read = recv(sock, p, i, MSG_PEEK);
- i = can_read;
+ if (tmo < 0) {
+ /* There's something to read. Read what's available and proceed
+ disregarding whether len could be exhausted or not.*/
+ int can_read = recv(sock, p, i, MSG_PEEK);
+ i = can_read;
+ }
got_now = recv(sock, p, i, 0);
if (got_now == -1) {