mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
Merge pull request #2287 from dandedrick/journal-gatewayd-timeout-fix
journal-gatewayd: timeout journal wait to allow thread cleanup
This commit is contained in:
commit
cf6c8c46fc
@ -45,6 +45,8 @@
|
||||
#include "sigbus.h"
|
||||
#include "util.h"
|
||||
|
||||
#define JOURNAL_WAIT_TIMEOUT (10*USEC_PER_SEC)
|
||||
|
||||
static char *arg_key_pem = NULL;
|
||||
static char *arg_cert_pem = NULL;
|
||||
static char *arg_trust_pem = NULL;
|
||||
@ -181,11 +183,13 @@ static ssize_t request_reader_entries(
|
||||
} else if (r == 0) {
|
||||
|
||||
if (m->follow) {
|
||||
r = sd_journal_wait(m->journal, (uint64_t) -1);
|
||||
r = sd_journal_wait(m->journal, (uint64_t) JOURNAL_WAIT_TIMEOUT);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Couldn't wait for journal event: %m");
|
||||
return MHD_CONTENT_READER_END_WITH_ERROR;
|
||||
}
|
||||
if (r == SD_JOURNAL_NOP)
|
||||
break;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -241,6 +245,8 @@ static ssize_t request_reader_entries(
|
||||
}
|
||||
|
||||
n = m->size - pos;
|
||||
if (n < 1)
|
||||
return 0;
|
||||
if (n > max)
|
||||
n = max;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user