From: Ken Raeburn Date: Fri, 18 Jul 2008 06:50:34 +0000 (+0000) Subject: Set non-blocking mode on incoming TCP connections. X-Git-Tag: krb5-1.7-alpha1~582 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e9c40f238840455ea74eed397967ff16f0ba3930;p=krb5.git 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 --- diff --git a/src/kdc/network.c b/src/kdc/network.c index f471a3a70..f3b87a176 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; }