]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/fde.cc
2 * Copyright (C) 1996-2015 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"
15 #include "SquidTime.h"
18 fde
*fde::Table
= NULL
;
21 fde::readPending(int fdNumber
)
23 if (type
== FD_SOCKET
)
24 return Comm::MonitorsRead(fdNumber
);
26 return read_handler
? true : false ;
30 fde::dumpStats (StoreEntry
&dumpEntry
, int fdNumber
)
37 storeAppendPrintf(&dumpEntry
, "%4d 0x%-8lX %-6.6s %4d %7" PRId64
"%c %7" PRId64
"%c %-21s %s\n",
41 storeAppendPrintf(&dumpEntry
, "%4d %-6.6s %4d %7" PRId64
"%c %7" PRId64
"%c %-21s %s\n",
45 timeoutHandler
!= NULL
? (int) (timeout
- squid_curtime
) : 0,
47 readPending(fdNumber
) ? '*' : ' ',
49 write_handler
? '*' : ' ',
55 fde::DumpStats (StoreEntry
*dumpEntry
)
58 storeAppendPrintf(dumpEntry
, "Active file descriptors:\n");
61 storeAppendPrintf(dumpEntry
, "%-4s %-10s %-6s %-4s %-7s* %-7s* %-21s %s\n",
65 storeAppendPrintf(dumpEntry
, "%-4s %-6s %-4s %-7s* %-7s* %-21s %s\n",
75 storeAppendPrintf(dumpEntry
, "---- ---------- ------ ---- -------- -------- --------------------- ------------------------------\n");
77 storeAppendPrintf(dumpEntry
, "---- ------ ---- -------- -------- --------------------- ------------------------------\n");
80 for (i
= 0; i
< Squid_MaxFD
; ++i
) {
81 fd_table
[i
].dumpStats(*dumpEntry
, i
);
86 fde::remoteAddr() const
88 LOCAL_ARRAY(char, buf
, MAX_IPSTRLEN
);
90 if (type
!= FD_SOCKET
)
94 snprintf( buf
, MAX_IPSTRLEN
, "%s:%d", ipaddr
, (int)remote_port
);
96 local_addr
.toUrl(buf
,MAX_IPSTRLEN
); // toHostStr does not include port.