decrease noise from bad connections
authorMarko Kreen <markokr@gmail.com>
Thu, 3 Jul 2008 13:01:19 +0000 (13:01 +0000)
committerMarko Kreen <markokr@gmail.com>
Thu, 3 Jul 2008 13:01:19 +0000 (13:01 +0000)
the accepting new connection does not need to stop if bad one appears.

src/objects.c
src/pooler.c
src/sbuf.c

index 89c5b1c419f719b2e50d9b82f1920ab050dc36b0..f439571dc8330c7b73cb7ad55e077bcd0fc9ccd6 100644 (file)
@@ -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;
 }
index 5d0cacb5d9904a8663f328405f71159d1e9dfaa9..30eec6a9f287799f51b569707690d0379c77d337 100644 (file)
@@ -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
index 1daf0b45a96ef1baefaed1792afb96e0c38f0856..c76ecb845cfbfee8d631941c98ee4c1a0fab525c 100644 (file)
@@ -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;
        }