mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-04 10:26:02 -05:00
buffer output on web pages, make safari faster
This commit is contained in:
parent
a1d5de6b54
commit
11fa293e41
@ -198,9 +198,15 @@ void config_subst_stream(WS_CONNINFO *pwsc, int fd_src) {
|
|||||||
CONFIGELEMENT *pce;
|
CONFIGELEMENT *pce;
|
||||||
char *first, *last;
|
char *first, *last;
|
||||||
|
|
||||||
|
char outbuffer[1024];
|
||||||
|
int out_index;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* now throw out the file, with replacements */
|
/* now throw out the file, with replacements */
|
||||||
in_arg=0;
|
in_arg=0;
|
||||||
argptr=argbuffer;
|
argptr=argbuffer;
|
||||||
|
out_index=0;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
if(r_read(fd_src,&next,1) <= 0)
|
if(r_read(fd_src,&next,1) <= 0)
|
||||||
@ -240,12 +246,27 @@ void config_subst_stream(WS_CONNINFO *pwsc, int fd_src) {
|
|||||||
argptr=argbuffer;
|
argptr=argbuffer;
|
||||||
memset(argbuffer,0,sizeof(argbuffer));
|
memset(argbuffer,0,sizeof(argbuffer));
|
||||||
in_arg=1;
|
in_arg=1;
|
||||||
|
|
||||||
|
/* flush whatever is in the buffer */
|
||||||
|
if(out_index) {
|
||||||
|
r_write(pwsc->fd,outbuffer,out_index);
|
||||||
|
out_index=0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if(r_write(pwsc->fd,&next,1) == -1)
|
outbuffer[out_index] = next;
|
||||||
break;
|
out_index++;
|
||||||
|
|
||||||
|
if(out_index == sizeof(outbuffer)) {
|
||||||
|
r_write(pwsc->fd,outbuffer,out_index);
|
||||||
|
out_index=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(out_index) {
|
||||||
|
r_write(pwsc->fd,outbuffer,out_index);
|
||||||
|
out_index=0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user