summaryrefslogtreecommitdiff
path: root/src/shared/log.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-14 11:54:26 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-20 22:47:26 -0500
commit4d89874af6a798744a32deb314001a13a28f0559 (patch)
tree94b6c07a0aa096ebff644b7ec71f9f3fe057f87b /src/shared/log.c
parent3c547e6f8ef6bd37df1197862e1aca63d434cbff (diff)
logging: reduce send timeout to something more sensible
For a user, the timeout of 1 min per message seems equivalent to a hang. If journald cannot process a message from PID1 for 10 ms then something is significantly wrong. It's better to lose the message and continue.
Diffstat (limited to 'src/shared/log.c')
-rw-r--r--src/shared/log.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shared/log.c b/src/shared/log.c
index b5b82f61c1..268f0340a1 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -126,7 +126,10 @@ static int create_log_socket(int type) {
/* We need a blocking fd here since we'd otherwise lose
messages way too early. However, let's not hang forever in the
unlikely case of a deadlock. */
- timeval_store(&tv, 1*USEC_PER_MINUTE);
+ if (getpid() == 1)
+ timeval_store(&tv, 10 * USEC_PER_MSEC);
+ else
+ timeval_store(&tv, 10 * USEC_PER_SEC);
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
return fd;