From 0fed3e1eccfdbae81961b3aadff0375c54c9f8d5 Mon Sep 17 00:00:00 2001 From: Michel Verbraak Date: Thu, 27 Dec 2007 14:20:37 +0000 Subject: net_plugin not always reading preview buffer to the maximum. --- src/input/input_net.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/input/input_net.c b/src/input/input_net.c index 4dfa63eda..fe78c93f4 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -411,6 +411,8 @@ static int net_plugin_open (input_plugin_t *this_gen ) { char *filename; char *pptr; int port = 7658; + int toread = MAX_PREVIEW_SIZE; + int trycount = 0; filename = this->host_port; pptr=strrchr(filename, ':'); @@ -429,11 +431,15 @@ static int net_plugin_open (input_plugin_t *this_gen ) { /* * fill preview buffer */ + while ((toread > 0) && (trycount < 10)) { #ifndef WIN32 - this->preview_size = read (this->fh, this->preview, MAX_PREVIEW_SIZE); + this->preview_size += read (this->fh, this->preview + this->preview_size, toread); #else - this->preview_size = recv (this->fh, this->preview, MAX_PREVIEW_SIZE, 0); + this->preview_size += recv (this->fh, this->preview + this->preview_size, toread, 0); #endif + trycount++; + toread = MAX_PREVIEW_SIZE - this->preview_size; + } this->curpos = 0; -- cgit v1.2.3