TcpAcceptor.cc
Go to the documentation of this file.
43 Comm::TcpAcceptor::TcpAcceptor(const Comm::ConnectionPointer &newConn, const char *, const Subscription::Pointer &aSub) :
51 Comm::TcpAcceptor::TcpAcceptor(const AnyP::PortCfgPointer &p, const char *, const Subscription::Pointer &aSub) :
155 debugs(50, DBG_CRITICAL, "ERROR: listen(..., " << (Squid_MaxFD >> 2) << ") system call failed: " << xstrerr(errcode));
163 debugs(5, DBG_IMPORTANT, "Installing accept filter '" << Config.accept_filter << "' on " << conn);
167 debugs(5, DBG_CRITICAL, "WARNING: SO_ACCEPTFILTER '" << Config.accept_filter << "': '" << xstrerr(xerrno));
175 debugs(5, DBG_CRITICAL, "WARNING: TCP_DEFER_ACCEPT '" << Config.accept_filter << "': '" << xstrerr(xerrno));
320 Comm::TcpAcceptor::notify(const Comm::Flag flag, const Comm::ConnectionPointer &newConnDetails) const
351 const auto rawSock = accept(conn->fd, reinterpret_cast<struct sockaddr *>(&remoteAddress), &remoteAddressSize);
358 throw TextException(ToSBuf("Failed to accept an incoming connection: ", xstrerr(errcode)), Here());
378 if (getsockname(sock, reinterpret_cast<struct sockaddr *>(&localAddress), &localAddressSize) != 0) {
380 debugs(50, DBG_IMPORTANT, "ERROR: Closing accepted TCP connection after failing to obtain its local IP address" <<
388 if (conn->flags & COMM_TRANSPARENT) { // the real client/dest IP address must be already available via getsockname()
391 debugs(50, DBG_IMPORTANT, "ERROR: Cannot use transparent " << details << " because TPROXY mode became inactive");
395 } else if (conn->flags & COMM_INTERCEPTION) { // request the real client/dest IP address from NAT
417 debugs(50, DBG_IMPORTANT, "WARNING: " << details->remote << " attempting more than " << Config.client_ip_max_connections << " connections.");
Definition: AsyncJob.h:31
AsyncCall::Pointer comm_add_close_handler(int fd, CLCB *handler, void *data)
Definition: comm.cc:952
Definition: FilledChecklist.h:33
int incoming_sockets_accepted
void appendf(const char *fmt,...) PRINTF_FORMAT_ARG2
Append operation with printf-style arguments.
Definition: Packable.h:61
Definition: CommCalls.h:92
void enterOrphanage()
close the still-open connection when its last reference is gone
Definition: Connection.h:90
AnyP::PortCfgPointer port
the configuration listening port this call relates to (may be nil)
Definition: CommCalls.h:100
void handleClosure(const CommCloseCbParams &io)
Definition: TcpAcceptor.cc:190
void setVirginUrlForMissingRequest(const SBuf &vu)
Remember Client URI (or equivalent) when there is no HttpRequest.
Definition: AccessLogEntry.h:260
int clientdbEstablished(const Ip::Address &addr, int delta)
Definition: client_db.cc:182
Abstraction layer for TCP, UDP, TLS, UDS and filedescriptor sockets.
Definition: AcceptLimiter.h:16
void accessLogLog(const AccessLogEntryPointer &, ACLChecklist *)
Definition: access_log.cc:136
void CallBack(const CodeContext::Pointer &callbackContext, Fun &&callback)
Definition: CodeContext.h:126
Definition: AccessLogEntry.h:40
char * toStr(char *buf, const unsigned int blen, int force=AF_UNSPEC) const
Definition: Address.cc:812
bool acceptInto(Comm::ConnectionPointer &)
Definition: TcpAcceptor.cc:344
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
Definition: forward.h:25
struct StatCounters::@119 syscalls
TcpAcceptor(const TcpAcceptor &)
Definition: MemBuf.h:23
Comm::ConnectionPointer tcpClient
TCP/IP level details about the client connection.
Definition: AccessLogEntry.h:80
struct StatCounters::@119::@124 sock
std::ostream & CurrentException(std::ostream &os)
prints active (i.e., thrown but not yet handled) exception
Definition: TextException.cc:88
void ApplyTcpKeepAlive(int fd, const TcpKeepAlive &)
apply configured TCP keep-alive settings to the given FD socket
Definition: Tcp.cc:51
Definition: CommCalls.h:165
#define JobCallback(dbgSection, dbgLevel, Dialer, job, method)
Convenience macro to create a Dialer-based job callback.
Definition: AsyncJobCalls.h:70
Definition: TcpAcceptor.h:38
void notify(const Comm::Flag flag, const Comm::ConnectionPointer &details) const
Call the subscribed callback handler with details about a new connection.
Definition: TcpAcceptor.cc:320
int Squid_MaxFD
CBDATA_NAMESPACED_CLASS_INIT(Comm, TcpAcceptor)
virtual const char * status() const
internal cleanup; do not call directly
Definition: AsyncJob.cc:182
void defer(const TcpAcceptor::Pointer &afd)
Definition: AcceptLimiter.cc:24
static void doAccept(int fd, void *data)
Method callback for whenever an FD is ready to accept a client connection.
Definition: TcpAcceptor.cc:210
nfmark_t getNfConnmark(const Comm::ConnectionPointer &conn, const ConnectionDirection connDir)
Definition: QosConfig.cc:150
void SetSelect(int, unsigned int, PF *, void *, time_t)
Mark an FD to be watched for its IO status.
Definition: ModDevPoll.cc:220
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
Definition: Stream.h:63
int RESERVED_FD
const char * status() const override
internal cleanup; do not call directly
Definition: TcpAcceptor.cc:124
Definition: CommCalls.h:127
void removeDead(const TcpAcceptor::Pointer &afd)
Definition: AcceptLimiter.cc:31
void logAcceptError(const ConnectionPointer &tcpClient) const
Definition: TcpAcceptor.cc:248
void subscribe(const Subscription::Pointer &aSub)
Definition: TcpAcceptor.cc:60
void comm_remove_close_handler(int fd, CLCB *handler, void *data)
Definition: comm.cc:981
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products