]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: remove unsused fd_debug_t and fdd_table
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 4 Feb 2017 16:30:49 +0000 (05:30 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 4 Feb 2017 16:30:49 +0000 (05:30 +1300)
This tables used to store the file and line location where each FD was
closed from, but never read for any reports or logs.

Make the cache.log debugging for comm_close display that information
instead of storing it in memory. This way when debug of the comm layer
is enabled the closure information for each FD open/close cycle is
recorded and not just the place of last closure.

Also we save a few hundred KB of memory this table was using and all the
CPU cycles used to maintain it when debugging was not needed.

src/comm.cc
src/comm/TcpAcceptor.cc
src/comm/comm_internal.h

index 1b62d7d19a37d0fcc1cbfd0ff7a4195e400c78c6..a1f4409eb1f4a05b34e2a725839aed2cd7639170 100644 (file)
@@ -82,8 +82,6 @@ static void commSetTcpNoDelay(int);
 #endif
 static void commSetTcpRcvbuf(int, int);
 
-fd_debug_t *fdd_table = NULL;
-
 bool
 isOpen(const int fd)
 {
@@ -428,9 +426,6 @@ comm_init_opened(const Comm::ConnectionPointer &conn,
     assert(!isOpen(conn->fd)); // NP: global isOpen checks the fde entry for openness not the Comm::Connection
     fd_open(conn->fd, FD_SOCKET, note);
 
-    fdd_table[conn->fd].close_file = NULL;
-    fdd_table[conn->fd].close_line = 0;
-
     fde *F = &fd_table[conn->fd];
     F->local_addr = conn->local;
 
@@ -862,13 +857,11 @@ comm_close_complete(const FdeCbParams &params)
 void
 _comm_close(int fd, char const *file, int line)
 {
-    debugs(5, 3, "comm_close: start closing FD " << fd);
+    debugs(5, 3, "start closing FD " << fd << " by " << file << ":" << line);
     assert(fd >= 0);
     assert(fd < Squid_MaxFD);
 
     fde *F = &fd_table[fd];
-    fdd_table[fd].close_file = file;
-    fdd_table[fd].close_line = line;
 
     if (F->closing())
         return;
@@ -1229,7 +1222,6 @@ void
 comm_init(void)
 {
     fd_table =(fde *) xcalloc(Squid_MaxFD, sizeof(fde));
-    fdd_table = (fd_debug_t *)xcalloc(Squid_MaxFD, sizeof(fd_debug_t));
 
     /* make sure the accept() socket FIFO delay queue exists */
     Comm::AcceptLimiter::Instance();
@@ -1256,7 +1248,6 @@ comm_exit(void)
     TheHalfClosed = NULL;
 
     safe_free(fd_table);
-    safe_free(fdd_table);
     Comm::CallbackTableDestruct();
 }
 
@@ -1926,10 +1917,6 @@ comm_open_uds(int sock_type,
     assert(!isOpen(new_socket));
     fd_open(new_socket, FD_MSGHDR, addr->sun_path);
 
-    fdd_table[new_socket].close_file = NULL;
-
-    fdd_table[new_socket].close_line = 0;
-
     fd_table[new_socket].sock_family = AI.ai_family;
 
     if (!(flags & COMM_NOCLOEXEC))
index 189f5a6849af1b1aa3152977c8874bff686d6df3..ba77cb6191f2088b51b98559d784092325a3752b 100644 (file)
@@ -407,9 +407,6 @@ Comm::TcpAcceptor::oldAccept(Comm::ConnectionPointer &details)
     // so we end up with a uniform "(HTTP|FTP-data|HTTPS|...) remote-ip:remote-port"
     fd_open(sock, FD_SOCKET, "HTTP Request");
 
-    fdd_table[sock].close_file = NULL;
-    fdd_table[sock].close_line = 0;
-
     fde *F = &fd_table[sock];
     details->remote.toStr(F->ipaddr,MAX_IPSTRLEN);
     F->remote_port = details->remote.port();
index f9f2013d8aba9f8d429550a229fe134e888753a0..2062f4dcad4b0130e96cf00da63857749cd5b13c 100644 (file)
 
 /* misc collection of bits shared by Comm code, but not needed by the rest of Squid. */
 
-struct _fd_debug_t {
-    char const *close_file;
-    int close_line;
-};
-
-typedef struct _fd_debug_t fd_debug_t;
-extern fd_debug_t *fdd_table;
-
 bool isOpen(const int fd);
 void commStopHalfClosedMonitor(int fd);