Code

socket frontend: Notify about incomplete commands before closing connections.
authorSebastian Harl <sh@tokkee.org>
Thu, 7 Nov 2013 06:49:44 +0000 (07:49 +0100)
committerSebastian Harl <sh@tokkee.org>
Thu, 7 Nov 2013 06:49:44 +0000 (07:49 +0100)
src/frontend/sock.c

index 792c0e4601400a286cacd012381817bfe782e504..d7b2ee97324ddef9d32246f9be163ec30152f998 100644 (file)
@@ -345,10 +345,16 @@ static void
 connection_destroy(sdb_object_t *obj)
 {
        connection_obj_t *conn;
+       size_t len;
 
        assert(obj);
        conn = CONN(obj);
 
+       len = sdb_strbuf_len(conn->buf);
+       if (len)
+               sdb_log(SDB_LOG_INFO, "frontend: Discarding incomplete command "
+                               "(%zu bytes left in buffer)", len);
+
        sdb_log(SDB_LOG_DEBUG, "frontend: Closing connection on fd=%i", conn->fd);
        close(conn->fd);
        conn->fd = -1;