diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-05-21 22:31:07 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-05-21 22:31:07 +0000 |
commit | 547e358796b9d82041b94f18f9ddcb972b8f1e7e (patch) | |
tree | a9a49eb760ebf7d3f77f2dffac74902996574b95 /src/inputStream_http.c | |
parent | aea1ae9b9ec6d2e8d00d11ee59047a8e71afe123 (diff) | |
download | mpd-547e358796b9d82041b94f18f9ddcb972b8f1e7e.tar.gz mpd-547e358796b9d82041b94f18f9ddcb972b8f1e7e.tar.xz mpd-547e358796b9d82041b94f18f9ddcb972b8f1e7e.zip |
do input buffering in while sleeping loop of sending stuff to output buffer
git-svn-id: https://svn.musicpd.org/mpd/trunk@1125 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/inputStream_http.c')
-rw-r--r-- | src/inputStream_http.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/inputStream_http.c b/src/inputStream_http.c index 1e88db114..c9cde55f2 100644 --- a/src/inputStream_http.c +++ b/src/inputStream_http.c @@ -542,20 +542,20 @@ int inputStream_httpBuffer(InputStream * inStream) { readed = read(data->sock, data->buffer+data->buflen, (size_t)(HTTP_BUFFER_SIZE-1-data->buflen)); - if(readed < 0 && (errno == EAGAIN || errno == EINTR)); + if(readed < 0 && (errno == EAGAIN || errno == EINTR)) { + readed = 0; + } else if(readed <= 0) { close(data->sock); data->connState = HTTP_CONN_STATE_CLOSED; + readed = 0; } - else { - /*fwrite(data->buffer+data->buflen,1,readed,stdout);*/ - data->buflen += readed; - } - + /*fwrite(data->buffer+data->buflen,1,readed,stdout);*/ + data->buflen += readed; } if(data->buflen > HTTP_PREBUFFER_SIZE) data->prebuffer = 0; - return 0; + return (readed ? 1 : 0); } /* vim:set shiftwidth=8 tabstop=8 expandtab: */ |