diff options
author | Ken Raeburn <raeburn@mit.edu> | 2008-07-18 06:50:34 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2008-07-18 06:50:34 +0000 |
commit | e9c40f238840455ea74eed397967ff16f0ba3930 (patch) | |
tree | d20cb0770ec45c4d42aad6864d857484d393ee27 | |
parent | 38c9c2df095e1ae4314f68e08966cd396c79e016 (diff) | |
download | krb5-e9c40f238840455ea74eed397967ff16f0ba3930.zip krb5-e9c40f238840455ea74eed397967ff16f0ba3930.tar.gz krb5-e9c40f238840455ea74eed397967ff16f0ba3930.tar.bz2 |
Set non-blocking mode on incoming TCP connections.
Don't log EINTR error in select loop.
Log when shutdown signal has been received and acted on.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20541 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r-- | src/kdc/network.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/kdc/network.c b/src/kdc/network.c index f471a3a..f3b87a1 100644 --- a/src/kdc/network.c +++ b/src/kdc/network.c @@ -386,12 +386,19 @@ delete_fd (struct connection *xconn) free(xconn); } +static const int one = 1; + static int setnbio(int sock) { - static const int one = 1; return ioctlsocket(sock, FIONBIO, (const void *)&one); } + +static int +setkeepalive(int sock) +{ + return setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(one)); +} static int setnolinger(int s) @@ -1251,7 +1258,7 @@ static void accept_tcp_connection(struct connection *conn, const char *prog, close(s); return; } - setnbio(s), setnolinger(s); + setnbio(s), setnolinger(s), setkeepalive(s); sockdata.prog = prog; sockdata.retval = 0; @@ -1570,7 +1577,8 @@ listen_and_process(const char *prog) err = krb5int_cm_call_select(&sstate, &sout, &sret); if (err) { - com_err(prog, err, "while selecting for network input(1)"); + if (err != EINTR) + com_err(prog, err, "while selecting for network input(1)"); continue; } if (sret == 0 && netchanged) { @@ -1601,6 +1609,7 @@ listen_and_process(const char *prog) service_conn(conns[i], prog, sflags); } } + krb5_klog_syslog(LOG_INFO, "shutdown signal received"); return 0; } |