From f9aad4c6ea1a8521d9eeb4630d413de56c0731d1 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Thu, 3 Jul 2008 13:01:19 +0000 Subject: [PATCH] decrease noise from bad connections the accepting new connection does not need to stop if bad one appears. --- src/objects.c | 9 +++++---- src/pooler.c | 5 ----- src/sbuf.c | 4 ++-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/objects.c b/src/objects.c index 89c5b1c..f439571 100644 --- a/src/objects.c +++ b/src/objects.c @@ -769,6 +769,7 @@ PgSocket * accept_client(int sock, /* get free PgSocket */ client = obj_alloc(client_cache); if (!client) { + log_warning("cannot allocate client struct"); safe_close(sock); return NULL; } @@ -781,12 +782,12 @@ PgSocket * accept_client(int sock, change_client_state(client, CL_LOGIN); - if (cf_log_connections) - slog_debug(client, "got connection attempt"); res = sbuf_accept(&client->sbuf, sock, is_unix); - if (!res) + if (!res) { + if (cf_log_connections) + slog_debug(client, "failed connection attempt"); return NULL; - + } return client; } diff --git a/src/pooler.c b/src/pooler.c index 5d0cacb..30eec6a 100644 --- a/src/pooler.c +++ b/src/pooler.c @@ -259,11 +259,6 @@ loop: client = accept_client(fd, &addr.in, false); } - if (!client) { - log_warning("P: no mem for client struct"); - return; - } - /* * there may be several clients waiting, * avoid context switch by looping diff --git a/src/sbuf.c b/src/sbuf.c index 1daf0b4..c76ecb8 100644 --- a/src/sbuf.c +++ b/src/sbuf.c @@ -654,12 +654,12 @@ static bool sbuf_after_connect_check(SBuf *sbuf) err = getsockopt(sbuf->sock, SOL_SOCKET, SO_ERROR, (void*)&optval, &optlen); if (err < 0) { - log_error("sbuf_after_connect_check: getsockopt: %s", + log_debug("sbuf_after_connect_check: getsockopt: %s", strerror(errno)); return false; } if (optval != 0) { - log_error("sbuf_after_connect_check: pending error: %s", + log_debug("sbuf_after_connect_check: pending error: %s", strerror(optval)); return false; } -- 2.39.5