sse-multiplex: don't block on client sockets

Rather kill a client connection when the write buffer is full than blocking
in sse-multiplexd.
This commit is contained in:
Matthias Schiffer 2016-01-12 15:25:15 +01:00
parent 50c763b895
commit 2fc02029b9
1 changed files with 3 additions and 1 deletions

View File

@ -236,7 +236,7 @@ static void remove_provider(provider_t *p) {
}
static void add_client(provider_t *p, FILE *file) {
if (fputs(p->header, file) == EOF || fflush(file) == EOF) {
if (fputs(p->header, file) == EOF || fflush(file) == EOF || ferror(file)) {
fclose(file);
return;
}
@ -415,6 +415,8 @@ static void handle_accept(uint32_t events) {
return;
}
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
provider_t *p = get_provider(command);
if (!p) {
fclose(file);