cvs: php4 /sapi/tux php_tux.c
| From: | Sascha Schumann | Date: | Mon, 04 Mar 2002 08:25:21 +0000 |
| Subject: | cvs: php4 /sapi/tux php_tux.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-9618@lists.php.net to get a copy of this message | ||
sas Mon Mar 4 03:25:21 2002 EDT
Modified files:
/php4/sapi/tux php_tux.c
Log:
Reduce operations in the ub_write loop.
Index: php4/sapi/tux/php_tux.c
diff -u php4/sapi/tux/php_tux.c:1.14 php4/sapi/tux/php_tux.c:1.15
--- php4/sapi/tux/php_tux.c:1.14 Mon Mar 4 03:22:33 2002
+++ php4/sapi/tux/php_tux.c Mon Mar 4 03:25:20 2002
@@ -52,8 +52,8 @@
static int sapi_tux_ub_write(const char *str, uint str_length TSRMLS_DC)
{
int n;
- uint sent = 0;
int m;
+ const char *estr;
/* combine headers and body */
if (TG(number_vec)) {
@@ -73,9 +73,11 @@
TG(number_vec) = 0;
return str_length;
}
+
+ estr = str + str_length;
- while (str_length > 0) {
- n = send(TG(req)->sock, str, str_length, 0);
+ while (str < estr) {
+ n = send(TG(req)->sock, str, estr - str, 0);
if (n == -1 && errno == EPIPE)
php_handle_aborted_connection();
@@ -84,13 +86,14 @@
if (n <= 0)
return n;
- TG(req)->bytes_sent += n;
str += n;
- sent += n;
- str_length -= n;
}
- return sent;
+ n = str_length - (estr - str);
+
+ TG(req)->bytes_sent += n;
+
+ return n;
}
static int sapi_tux_send_headers(sapi_headers_struct *sapi_headers)