http_poll() function
The poll function is called every 2nd second. If there has been no data sent (which resets the retries) in 8 seconds, close. If the last portion of a file has not been sent in 2 seconds, close. This could be increased, but we don't want to waste resources for bad connections.