mod/chat - Normal method - users pane only uses keepalive when refreshing fast

To avoid wasting server resources, user's pane now only uses keepalive
when the refresh is lower than apache's timeout.
This commit is contained in:
martinlanghoff
2006-04-17 21:05:17 +00:00
parent 6169ea259a
commit c5e817f02c
+18 -3
View File
@@ -134,9 +134,24 @@
}
echo '</table></body></html>';
// support HTTP Keep-Alive
header("Content-Length: " . ob_get_length() );
ob_end_flush();
//
// Support HTTP Keep-Alive by printing Content-Length
//
// If the user pane is refreshing often, using keepalives
// is lighter on the server and faster for most clients.
//
// Apache is normally configured to have a 15s timeout on
// keepalives, so let's observe that. Unfortunately, we cannot
// autodetect the keepalive timeout.
//
// Using keepalives when the refresh is longer than the timeout
// wastes server resources keeping an apache child around on a
// connection that will timeout. So we don't.
if ($CFG->chat_refresh_userlist < 15) {
header("Content-Length: " . ob_get_length() );
ob_end_flush();
}
exit; // no further output