From 6d57b326fa47d19111cf6ae51bb4cd9c8652407b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 3 Nov 2016 11:42:42 -0400 Subject: [PATCH] change logic of sending file contents to handle an off by one and be more readable --- web/views/view_video.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/web/views/view_video.php b/web/views/view_video.php index 67006c285..95d0d0c29 100644 --- a/web/views/view_video.php +++ b/web/views/view_video.php @@ -94,10 +94,11 @@ flush(); $cur = $begin; fseek( $fh, $begin, 0 ); -while( ! feof( $fh ) && $cur < $end && ( connection_status() == 0 ) ) { - #Error("Sending $cur"); - print fread( $fh, min( 1024*16, $end - $cur ) ); - $cur += 1024*16; +while( $length && ( ! feof( $fh ) ) && ( connection_status() == 0 ) ) { + $amount = min( 1024*16, $length ); + + print fread( $fh, $amount ); + $length -= $amount; usleep(100); }