summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/input/input_net.c10
1 files 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;