cvs: php4 /sapi/thttpd thttpd.c

From: Date: Wed, 10 Jan 2001 13:51:58 +0000
Subject: cvs: php4 /sapi/thttpd thttpd.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-3540@lists.php.net to get a copy of this message
sas Wed Jan 10 05:51:58 2001 EDT Modified files: /php4/sapi/thttpd thttpd.c Log: Especially on FreeBSD it seems to be common that send(2) does not do a decent job. We handle that better now. Index: php4/sapi/thttpd/thttpd.c diff -u php4/sapi/thttpd/thttpd.c:1.32 php4/sapi/thttpd/thttpd.c:1.33 --- php4/sapi/thttpd/thttpd.c:1.32 Tue Jan 9 01:01:33 2001 +++ php4/sapi/thttpd/thttpd.c Wed Jan 10 05:51:58 2001 @@ -42,17 +42,26 @@ static int sapi_thttpd_ub_write(const char *str, uint str_length) { int n; + uint sent = 0; TLS_FETCH(); - n = send(TG(hc)->conn_fd, str, str_length, 0); + while (str_length > 0) { + n = send(TG(hc)->conn_fd, str, str_length, 0); - if (n == -1 && errno == EPIPE) { - php_handle_aborted_connection(); - } + if (n == -1 && errno == EPIPE) + php_handle_aborted_connection(); + if (n == -1 && errno == EAGAIN) + continue; + if (n <= 0) + return n; - TG(hc)->bytes += n; + TG(hc)->bytes += n; + str += n; + sent += n; + str_length -= n; + } - return n; + return sent; } static int sapi_thttpd_send_headers(sapi_headers_struct *sapi_headers SLS_DC)

« previous php.cvs (#3540) next »