]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/fde.cc
2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
12 #include "comm/Read.h"
16 #include "SquidTime.h"
19 fde
*fde::Table
= NULL
;
22 fde::readPending(int fdNumber
)
24 if (type
== FD_SOCKET
)
25 return Comm::MonitorsRead(fdNumber
);
27 return read_handler
? true : false ;
31 fde::dumpStats (StoreEntry
&dumpEntry
, int fdNumber
)
38 storeAppendPrintf(&dumpEntry
, "%4d 0x%-8lX %-6.6s %4d %7" PRId64
"%c %7" PRId64
"%c %-21s %s\n",
42 storeAppendPrintf(&dumpEntry
, "%4d %-6.6s %4d %7" PRId64
"%c %7" PRId64
"%c %-21s %s\n",
46 timeoutHandler
!= NULL
? (int) (timeout
- squid_curtime
) : 0,
48 readPending(fdNumber
) ? '*' : ' ',
50 write_handler
? '*' : ' ',
56 fde::DumpStats (StoreEntry
*dumpEntry
)
59 storeAppendPrintf(dumpEntry
, "Active file descriptors:\n");
62 storeAppendPrintf(dumpEntry
, "%-4s %-10s %-6s %-4s %-7s* %-7s* %-21s %s\n",
66 storeAppendPrintf(dumpEntry
, "%-4s %-6s %-4s %-7s* %-7s* %-21s %s\n",
76 storeAppendPrintf(dumpEntry
, "---- ---------- ------ ---- -------- -------- --------------------- ------------------------------\n");
78 storeAppendPrintf(dumpEntry
, "---- ------ ---- -------- -------- --------------------- ------------------------------\n");
81 for (i
= 0; i
< Squid_MaxFD
; ++i
) {
82 fd_table
[i
].dumpStats(*dumpEntry
, i
);
87 fde::remoteAddr() const
89 LOCAL_ARRAY(char, buf
, MAX_IPSTRLEN
);
91 if (type
!= FD_SOCKET
)
95 snprintf( buf
, MAX_IPSTRLEN
, "%s:%d", ipaddr
, (int)remote_port
);
97 local_addr
.toUrl(buf
,MAX_IPSTRLEN
); // toHostStr does not include port.