#include "squid.h"
#include "base/AsyncFunCalls.h"
#include "ClientInfo.h"
#include "comm/AcceptLimiter.h"
#include "comm/comm_internal.h"
#include "comm/Connection.h"
#include "comm/IoCallback.h"
#include "comm/Loops.h"
#include "comm/Read.h"
#include "comm/TcpAcceptor.h"
#include "comm/Write.h"
#include "compat/cmsg.h"
#include "DescriptorSet.h"
#include "event.h"
#include "fd.h"
#include "fde.h"
#include "globals.h"
#include "icmp/net_db.h"
#include "ip/Intercept.h"
#include "ip/QosConfig.h"
#include "ip/tools.h"
#include "pconn.h"
#include "sbuf/SBuf.h"
#include "sbuf/Stream.h"
#include "SquidConfig.h"
#include "StatCounters.h"
#include "StoreIOBuffer.h"
#include "tools.h"
#include "ssl/support.h"
#include <cerrno>
#include <cmath>
Go to the source code of this file.
Functions | |
static int | comm_openex (int sock_type, int proto, Ip::Address &, int flags, const char *note) |
static void | comm_init_opened (const Comm::ConnectionPointer &conn, const char *note, struct addrinfo *AI) |
update FD tables after a local or remote (IPC) comm_openex(); More... | |
static int | comm_apply_flags (int new_socket, Ip::Address &addr, int flags, struct addrinfo *AI) |
static void | commHandleWriteHelper (void *data) |
static void | commPlanHalfClosedCheck () |
static Comm::Flag | commBind (int s, struct addrinfo &) |
static void | commSetBindAddressNoPort (int) |
static void | commSetReuseAddr (int) |
static void | commSetNoLinger (int) |
static void | commSetTcpRcvbuf (int, int) |
bool | isOpen (const int fd) |
static void | comm_empty_os_read_buffers (int fd) |
int | comm_udp_recvfrom (int fd, void *buf, size_t len, int flags, Ip::Address &from) |
int | comm_udp_recv (int fd, void *buf, size_t len, int flags) |
ssize_t | comm_udp_send (int s, const void *buf, size_t len, int flags) |
bool | comm_has_incomplete_write (int fd) |
unsigned short | comm_local_port (int fd) |
int | comm_open (int sock_type, int proto, Ip::Address &addr, int flags, const char *note) |
void | comm_open_listener (int sock_type, int proto, Comm::ConnectionPointer &conn, const char *note) |
int | comm_open_listener (int sock_type, int proto, Ip::Address &addr, int flags, const char *note) |
static bool | limitError (int const anErrno) |
static void | comm_set_v6only (int fd, int tos) |
static void | comm_set_transparent (int fd) |
void | comm_import_opened (const Comm::ConnectionPointer &conn, const char *note, struct addrinfo *AI) |
update Comm state after getting a comm_open() FD from another process More... | |
void | commUnsetFdTimeout (int fd) |
clear a timeout handler by FD number More... | |
int | commSetConnTimeout (const Comm::ConnectionPointer &conn, time_t timeout, AsyncCall::Pointer &callback) |
int | commUnsetConnTimeout (const Comm::ConnectionPointer &conn) |
int | comm_connect_addr (int sock, const Ip::Address &address) |
void | commCallCloseHandlers (int fd) |
void | comm_reset_close (const Comm::ConnectionPointer &conn) |
void | old_comm_reset_close (int fd) |
static void | commStartTlsClose (const int fd) |
static void | comm_close_complete (const int fd) |
void | _comm_close (int fd, char const *file, int line) |
int | comm_udp_sendto (int fd, const Ip::Address &to_addr, const void *buf, int len) |
AsyncCall::Pointer | comm_add_close_handler (int fd, CLCB *handler, void *data) |
void | comm_add_close_handler (int fd, AsyncCall::Pointer &call) |
void | comm_remove_close_handler (int fd, CLCB *handler, void *data) |
void | comm_remove_close_handler (int fd, AsyncCall::Pointer &call) |
int | commSetNonBlocking (int fd) |
int | commUnsetNonBlocking (int fd) |
void | commSetCloseOnExec (int fd) |
void | comm_init (void) |
void | comm_exit (void) |
int | ignoreErrno (int ierrno) |
void | commCloseAllSockets (void) |
static bool | AlreadyTimedOut (fde *F) |
static bool | writeTimedOut (int fd) |
void | checkTimeouts (void) |
void | commStartHalfClosedMonitor (int fd) |
Start waiting for a possibly half-closed connection to close. More... | |
static void | commHalfClosedCheck (void *) |
bool | commHasHalfClosedMonitor (int fd) |
checks whether we are waiting for possibly half-closed connection to close More... | |
void | commStopHalfClosedMonitor (int const fd) |
stop waiting for possibly half-closed connection to close More... | |
static void | commHalfClosedReader (const Comm::ConnectionPointer &conn, char *, size_t size, Comm::Flag flag, int, void *) |
I/O handler for the possibly half-closed connection monitoring code. More... | |
int | comm_open_uds (int sock_type, int proto, struct sockaddr_un *addr, int flags) |
Create a unix-domain socket (UDS) that only supports FD_MSGHDR I/O. More... | |
Variables | |
static IOCB | commHalfClosedReader |
static DescriptorSet * | TheHalfClosed = nullptr |
static bool | WillCheckHalfClosed = false |
the set of half-closed FDs More... | |
static EVH | commHalfClosedCheck |
true if check is scheduled More... | |
Function Documentation
◆ _comm_close()
Definition at line 846 of file comm.cc.
References assert, asyncCall(), callDialer(), comm_close_complete(), comm_empty_os_read_buffers(), COMM_SELECT_READ, COMM_SELECT_WRITE, commCallCloseHandlers(), commHasHalfClosedMonitor(), COMMIO_FD_READCB, COMMIO_FD_WRITECB, commStartTlsClose(), commStopHalfClosedMonitor(), commUnsetFdTimeout(), DBG_IMPORTANT, debugs, Comm::ERR_CLOSING, F(), FD_FILE, fd_table, isOpen(), reconfiguring, ScheduleCallHere, BandwidthBucket::SelectBucket(), Comm::SetSelect(), shutting_down, and Squid_MaxFD.
◆ AlreadyTimedOut()
|
static |
Definition at line 1500 of file comm.cc.
References F(), and squid_curtime.
Referenced by checkTimeouts().
◆ checkTimeouts()
void checkTimeouts | ( | void | ) |
Definition at line 1527 of file comm.cc.
References AlreadyTimedOut(), Biggest_FD, comm_close, Comm::COMM_ERROR, COMM_SELECT_WRITE, COMMIO_FD_WRITECB, conn, debugs, F(), fd_table, Comm::HandleWrite, CodeContext::Reset(), ScheduleCallHere, Comm::SetSelect(), and writeTimedOut().
Referenced by CommSelectEngine::checkEvents().
◆ comm_add_close_handler() [1/2]
void comm_add_close_handler | ( | int | fd, |
AsyncCall::Pointer & | call | ||
) |
Definition at line 961 of file comm.cc.
References debugs, fd_table, and AsyncCall::setNext().
◆ comm_add_close_handler() [2/2]
AsyncCall::Pointer comm_add_close_handler | ( | int | fd, |
CLCB * | handler, | ||
void * | data | ||
) |
Definition at line 949 of file comm.cc.
References comm_add_close_handler(), commCbCall(), debugs, and handler().
Referenced by Mgr::Forwarder::Forwarder(), Snmp::Forwarder::Forwarder(), HttpStateData::HttpStateData(), Mgr::Inquirer::Inquirer(), Snmp::Inquirer::Inquirer(), Security::PeerConnector::PeerConnector(), Mgr::StoreToCommWriter::StoreToCommWriter(), comm_add_close_handler(), Log::TcpLogger::connectDone(), Comm::ConnOpener::createFd(), idnsInitVCConnected(), TunnelStateData::Connection::initConnection(), Ftp::Channel::opened(), Helper::Client::openSessions(), statefulhelper::openSessions(), ConnStateData::pinConnection(), Comm::TcpAcceptor::setListen(), ConnStateData::start(), FwdState::syncWithServerConn(), Adaptation::Icap::Xaction::useIcapConnection(), Http::Tunneler::watchForClosures(), and whoisStart().
◆ comm_apply_flags()
|
static |
apply flags after a local comm_open*() call; returns new_socket or -1 on error
Definition at line 463 of file comm.cc.
References assert, comm_close, COMM_DOBIND, COMM_DOBIND_PORT_LATER, Comm::COMM_ERROR, COMM_NOCLOEXEC, COMM_NONBLOCKING, COMM_REUSEADDR, COMM_REUSEPORT, comm_set_transparent(), COMM_TRANSPARENT, commBind(), commSetBindAddressNoPort(), commSetCloseOnExec(), commSetNoLinger(), commSetNonBlocking(), commSetReuseAddr(), commSetTcpRcvbuf(), Config, DBG_CRITICAL, DBG_IMPORTANT, debugs, Ip::Address::isAnyAddr(), Ip::Address::isNoAddr(), Comm::OK, opt_reuseaddr, Ip::Address::port(), reconfiguring, SquidConfig::tcpRcvBufsz, TexcHere, ToSBuf(), and xstrerr().
Referenced by comm_openex().
◆ comm_close_complete()
|
static |
Definition at line 820 of file comm.cc.
References StatCounters::closes, F(), fd_close(), fd_table, Comm::AcceptLimiter::Instance(), Comm::AcceptLimiter::kick(), CodeContext::Reset(), StatCounters::sock, statCounter, and StatCounters::syscalls.
Referenced by _comm_close().
◆ comm_connect_addr()
int comm_connect_addr | ( | int | sock, |
const Ip::Address & | address | ||
) |
Connect socket FD to given remote address. If return value is an error flag (COMM_ERROR, ERR_CONNECT, ERR_PROTOCOL, etc.), then error code will also be returned in errno.
Definition at line 634 of file comm.cc.
References assert, Comm::COMM_ERROR, StatCounters::connects, DBG_DATA, debugs, Comm::ERR_PROTOCOL, F(), fd_table, Ip::Address::FreeAddr(), Ip::Address::getAddrInfo(), ignoreErrno(), Comm::INPROGRESS, Ip::Address::isIPv4(), MAX_IPSTRLEN, Comm::OK, Ip::Address::port(), StatCounters::sock, statCounter, StatCounters::syscalls, Ip::Address::toStr(), and xstrerr().
Referenced by Comm::ConnOpener::doConnect(), ipc_thread_1(), ipcCreate(), and logfile_mod_udp_open().
◆ comm_empty_os_read_buffers()
|
static |
Empty the read buffers
This is a magical routine that empties the read buffers. Under some platforms (Linux) if a buffer has data in it before you call close(), the socket will hang and take quite a while to timeout.
Definition at line 102 of file comm.cc.
References FD_MSGHDR, FD_READ_METHOD(), and fd_table.
Referenced by _comm_close().
◆ comm_exit()
void comm_exit | ( | void | ) |
Definition at line 1189 of file comm.cc.
References Comm::CallbackTableDestruct(), and TheHalfClosed.
Referenced by SquidShutdown().
◆ comm_has_incomplete_write()
bool comm_has_incomplete_write | ( | int | fd | ) |
Definition at line 151 of file comm.cc.
References assert, COMMIO_FD_WRITECB, and isOpen().
Referenced by PconnPool::push().
◆ comm_import_opened()
void comm_import_opened | ( | const Comm::ConnectionPointer & | conn, |
const char * | note, | ||
struct addrinfo * | AI | ||
) |
Definition at line 542 of file comm.cc.
References assert, comm_init_opened(), COMM_NOCLOEXEC, COMM_NONBLOCKING, COMM_TRANSPARENT, conn, debugs, fd_table, and Comm::IsConnOpen().
Referenced by Ipc::ImportFdIntoComm(), and Ipc::SharedListenJoined().
◆ comm_init()
void comm_init | ( | void | ) |
Definition at line 1166 of file comm.cc.
References assert, Comm::CallbackTableInit(), fd_table, Comm::AcceptLimiter::Instance(), min(), RESERVED_FD, Comm::SelectLoopInit(), Squid_MaxFD, and TheHalfClosed.
Referenced by TestUfs::commonInit(), and SquidMain().
◆ comm_init_opened()
|
static |
Definition at line 441 of file comm.cc.
References assert, conn, debugs, F(), fd_open(), FD_SOCKET, fd_table, Comm::IsConnOpen(), and isOpen().
Referenced by comm_import_opened(), and comm_openex().
◆ comm_local_port()
unsigned short comm_local_port | ( | int | fd | ) |
Queue a write. handler/handler_data are called when the write fully completes, on error, or on file descriptor close.
Definition at line 164 of file comm.cc.
References DBG_IMPORTANT, debugs, F(), fd_table, Ip::Address::FreeAddr(), Ip::Address::InitAddr(), MYNAME, Ip::Address::port(), Ip::Address::setIPv4(), and xstrerr().
Referenced by comm_udp_sendto(), Dns::Init(), Ftp::Server::listenForDataConnection(), and Ftp::Client::sendEprt().
◆ comm_open()
int comm_open | ( | int | sock_type, |
int | proto, | ||
Ip::Address & | addr, | ||
int | flags, | ||
const char * | note | ||
) |
Create a socket. Default is blocking, stream (TCP) socket. IO_TYPE is OR of flags specified in comm.h. Defaults TOS
Definition at line 242 of file comm.cc.
References COMM_DOBIND, COMM_DOBIND_PORT_LATER, comm_openex(), Ip::Address::isAnyAddr(), and Ip::Address::port().
Referenced by Comm::ConnOpener::createFd(), ipc_thread_1(), ipcCreate(), and logfile_mod_udp_open().
◆ comm_open_listener() [1/2]
void comm_open_listener | ( | int | sock_type, |
int | proto, | ||
Comm::ConnectionPointer & | conn, | ||
const char * | note | ||
) |
Definition at line 256 of file comm.cc.
References COMM_DOBIND, comm_openex(), and conn.
Referenced by htcpOpenPorts(), icpOpenPorts(), Dns::Init(), ipcCreate(), Ftp::Gateway::listenForDataChannel(), Ftp::Server::listenForDataConnection(), Ipc::Coordinator::openListenSocket(), Ipc::StartListening(), wccp2ConnectionOpen(), and wccpConnectionOpen().
◆ comm_open_listener() [2/2]
int comm_open_listener | ( | int | sock_type, |
int | proto, | ||
Ip::Address & | addr, | ||
int | flags, | ||
const char * | note | ||
) |
Open a port specially bound for listening or sending through a specific port. Please use for all listening sockets and bind() outbound sockets.
It will open a socket bound for:
- IPv4 if IPv6 is disabled or address is IPv4-native.
- IPv6 if address is IPv6-native
- IPv6 dual-stack mode if able to open [::]
When an open performs failover it update the given address to feedback the new IPv4-only status of the socket. Further displays of the IP (in debugs or cachemgr) will occur in Native IPv4 format. A reconfigure is needed to reset the stored IP in most cases and attempt a port re-open.
Definition at line 269 of file comm.cc.
References COMM_DOBIND, and comm_openex().
◆ comm_open_uds()
int comm_open_uds | ( | int | sock_type, |
int | proto, | ||
struct sockaddr_un * | addr, | ||
int | flags | ||
) |
Definition at line 1710 of file comm.cc.
References assert, comm_close, COMM_DOBIND, COMM_NOCLOEXEC, COMM_NONBLOCKING, COMM_REUSEADDR, commBind(), commSetCloseOnExec(), commSetNonBlocking(), commSetReuseAddr(), commSetTcpRcvbuf(), Config, DBG_CRITICAL, DBG_IMPORTANT, debugs, FD_MSGHDR, fd_open(), fd_table, fdAdjustReserved(), isOpen(), limitError(), MYNAME, Comm::OK, StatCounters::sock, StatCounters::sockets, statCounter, SUN_LEN, sockaddr_un::sun_path, StatCounters::syscalls, SquidConfig::tcpRcvBufsz, and xstrerr().
Referenced by Ipc::UdsOp::conn().
◆ comm_openex()
|
static |
Create a socket. Default is blocking, stream (TCP) socket. IO_TYPE is OR of flags specified in defines.h:COMM_*
Definition at line 355 of file comm.cc.
References comm_apply_flags(), comm_init_opened(), comm_set_v6only(), conn, DBG_CRITICAL, DBG_IMPORTANT, debugs, Ip::EnableIpv6, fdAdjustReserved(), Ip::Address::FreeAddr(), Ip::Address::getAddrInfo(), IPV6_SPECIAL_SPLITSTACK, IPV6_SPECIAL_V4MAPPING, Ip::Address::isIPv6(), limitError(), MYNAME, Ip::Address::setIPv4(), StatCounters::sock, StatCounters::sockets, statCounter, StatCounters::syscalls, and xstrerr().
Referenced by comm_open(), and comm_open_listener().
◆ comm_remove_close_handler() [1/2]
void comm_remove_close_handler | ( | int | fd, |
AsyncCall::Pointer & | call | ||
) |
Definition at line 1007 of file comm.cc.
References assert, AsyncCall::cancel(), debugs, AsyncCall::dequeue(), fd_table, isOpen(), and AsyncCall::Next().
◆ comm_remove_close_handler() [2/2]
Definition at line 978 of file comm.cc.
References assert, AsyncCall::cancel(), debugs, AsyncCall::dequeue(), fd_table, RefCount< C >::getRaw(), handler(), isOpen(), and AsyncCall::Next().
Referenced by Ident::IdentStateData::~IdentStateData(), Comm::ConnOpener::cleanFd(), Snmp::Inquirer::cleanup(), Ftp::Channel::close(), Mgr::StoreToCommWriter::close(), Adaptation::Icap::Xaction::closeConnection(), HttpStateData::closeServer(), FwdState::closeServerConnection(), Http::Tunneler::disconnect(), Log::TcpLogger::disconnect(), Security::PeerConnector::disconnect(), Ftp::Channel::forget(), HttpStateData::proceedAfter1xx(), HttpStateData::processReplyBody(), Mgr::Inquirer::removeCloseHandler(), Comm::TcpAcceptor::swanSong(), Mgr::Forwarder::swanSong(), Snmp::Forwarder::swanSong(), ConnStateData::unpinConnection(), and FwdState::unregister().
◆ comm_reset_close()
void comm_reset_close | ( | const Comm::ConnectionPointer & | conn | ) |
enable linger with time of 0 so that when the socket is closed, TCP generates a RESET
Definition at line 785 of file comm.cc.
References conn, DBG_CRITICAL, debugs, and xstrerr().
Referenced by ConnStateData::abortChunkedRequestBody(), clientProcessRequestFinished(), Adaptation::Icap::ServiceRep::putConnection(), and ConnStateData::setAuth().
◆ comm_set_transparent()
|
static |
Set the socket option required for TPROXY spoofing for:
- Linux TPROXY v4 support,
- OpenBSD divert-to support,
- FreeBSD IPFW TPROXY v4 support.
Definition at line 312 of file comm.cc.
References DBG_CRITICAL, DBG_IMPORTANT, debugs, enter_suid(), fd_table, leave_suid(), MYNAME, and xstrerr().
Referenced by comm_apply_flags().
◆ comm_set_v6only()
Definition at line 293 of file comm.cc.
References DBG_CRITICAL, DBG_IMPORTANT, debugs, MYNAME, and xstrerr().
Referenced by comm_openex().
◆ comm_udp_recv()
Definition at line 138 of file comm.cc.
References comm_udp_recvfrom().
Referenced by ipcCreate(), and IcmpSquid::Recv().
◆ comm_udp_recvfrom()
int comm_udp_recvfrom | ( | int | fd, |
void * | buf, | ||
size_t | len, | ||
int | flags, | ||
Ip::Address & | from | ||
) |
synchronous wrapper around udp socket functions
Definition at line 125 of file comm.cc.
References debugs, Ip::Address::FreeAddr(), Ip::Address::InitAddr(), StatCounters::recvfroms, StatCounters::sock, statCounter, and StatCounters::syscalls.
Referenced by comm_udp_recv(), htcpRecv(), icpHandleUdp(), idnsRead(), snmpHandleUdp(), wccp2HandleUdp(), and wccpHandleUdp().
◆ comm_udp_send()
Definition at line 145 of file comm.cc.
Referenced by ipcCreate(), IcmpSquid::SendEcho(), wccpAssignBuckets(), and wccpHereIam().
◆ comm_udp_sendto()
int comm_udp_sendto | ( | int | fd, |
const Ip::Address & | to_addr, | ||
const void * | buf, | ||
int | len | ||
) |
Definition at line 918 of file comm.cc.
References Comm::COMM_ERROR, comm_local_port(), DBG_IMPORTANT, debugs, fd_table, Ip::Address::FreeAddr(), Ip::Address::getAddrInfo(), MYNAME, StatCounters::sendtos, StatCounters::sock, statCounter, StatCounters::syscalls, and xstrerr().
Referenced by htcpSend(), icpUdpSend(), idnsSendQuery(), Snmp::Forwarder::sendError(), Snmp::Inquirer::sendResponse(), snmpConstructReponse(), wccp2AssignBuckets(), and wccp2HereIam().
◆ commBind()
|
static |
Definition at line 223 of file comm.cc.
References StatCounters::binds, Comm::COMM_ERROR, DBG_CRITICAL, debugs, fd_table, MYNAME, Comm::OK, StatCounters::sock, statCounter, StatCounters::syscalls, and xstrerr().
Referenced by comm_apply_flags(), and comm_open_uds().
◆ commCallCloseHandlers()
void commCallCloseHandlers | ( | int | fd | ) |
Definition at line 759 of file comm.cc.
References AsyncCall::canceled(), debugs, F(), fd_table, AsyncCall::Next(), ScheduleCallHere, and AsyncCall::setNext().
Referenced by _comm_close(), and examine_select().
◆ commCloseAllSockets()
void commCloseAllSockets | ( | void | ) |
Definition at line 1470 of file comm.cc.
References Biggest_FD, debugs, F(), FD_SOCKET, fd_table, old_comm_reset_close(), and ScheduleCallHere.
Referenced by SquidShutdown().
◆ commHalfClosedCheck()
|
static |
iterates over all descriptors that may need half-closed tests and calls comm_read for those that do; re-schedules the check if needed
Definition at line 1603 of file comm.cc.
References DescriptorSet::begin(), CallBack(), commPlanHalfClosedCheck(), debugs, DescriptorSet::end(), Comm::Connection::fd, fd_table, TheHalfClosed, and WillCheckHalfClosed.
◆ commHalfClosedReader()
|
static |
Definition at line 1652 of file comm.cc.
References assert, commHasHalfClosedMonitor(), commPlanHalfClosedCheck(), conn, debugs, Comm::ERR_CLOSING, fd_table, Comm::OK, and size.
◆ commHandleWriteHelper()
|
static |
Definition at line 1200 of file comm.cc.
References assert, CommQuotaQueue::clientInfo, debugs, ClientInfo::eventWaiting, ClientInfo::hasQueue(), BandwidthBucket::selectWaiting, and ClientInfo::writeOrDequeue().
Referenced by ClientInfo::kickQuotaQueue().
◆ commHasHalfClosedMonitor()
bool commHasHalfClosedMonitor | ( | int | fd | ) |
Definition at line 1630 of file comm.cc.
References DescriptorSet::has(), and TheHalfClosed.
Referenced by _comm_close(), commHalfClosedReader(), commIsHalfClosed(), and commStartHalfClosedMonitor().
◆ commPlanHalfClosedCheck()
|
static |
Definition at line 1591 of file comm.cc.
References commHalfClosedCheck, DescriptorSet::empty(), eventAdd(), TheHalfClosed, and WillCheckHalfClosed.
Referenced by commHalfClosedCheck(), commHalfClosedReader(), and commStartHalfClosedMonitor().
◆ commSetBindAddressNoPort()
|
static |
sets the IP_BIND_ADDRESS_NO_PORT socket option to optimize ephemeral port reuse by outgoing TCP connections that must bind(2) to a source IP address
Definition at line 209 of file comm.cc.
References DBG_IMPORTANT, debugs, and xstrerr().
Referenced by comm_apply_flags().
◆ commSetCloseOnExec()
void commSetCloseOnExec | ( | int | fd | ) |
Definition at line 1127 of file comm.cc.
References DBG_CRITICAL, debugs, dummy, fd_table, MYNAME, and xstrerr().
Referenced by Comm::TcpAcceptor::acceptInto(), comm_apply_flags(), comm_open_uds(), file_open(), ipcCreate(), and DiskThreadsDiskFile::openDone().
◆ commSetConnTimeout()
int commSetConnTimeout | ( | const Comm::ConnectionPointer & | conn, |
time_t | seconds, | ||
AsyncCall::Pointer & | callback | ||
) |
Set or clear the timeout for some action on an active connection. API to replace commSetTimeout() when a Comm::ConnectionPointer is available.
Definition at line 595 of file comm.cc.
References assert, conn, debugs, F(), fd_table, Comm::IsConnOpen(), squid_curtime, and Squid_MaxFD.
Referenced by TunnelStateData::TunnelStateData(), commUnsetConnTimeout(), ConnStateData::extendLifetime(), idnsDoSendQueryVC(), TunnelStateData::keepGoingAfterRead(), Ftp::Client::maybeReadVirginBody(), Security::PeerConnector::noteWantRead(), Helper::Client::openSessions(), HttpStateData::processReplyBody(), IdleConnList::push(), Http::Tunneler::readMore(), Helper::Session::requestTimeout(), ConnStateData::resetReadTimeout(), Ftp::Client::scheduleReadControlReply(), HttpStateData::sendComplete(), HttpStateData::sendRequest(), Ipc::UdsOp::setTimeout(), Http::One::Server::start(), Ftp::Client::switchTimeoutToDataChannel(), tunnelStartShoveling(), Adaptation::Icap::Xaction::updateTimeout(), and whoisStart().
◆ commSetNoLinger()
|
static |
Definition at line 1022 of file comm.cc.
References DBG_CRITICAL, debugs, fd_table, MYNAME, and xstrerr().
Referenced by comm_apply_flags().
◆ commSetNonBlocking()
Definition at line 1066 of file comm.cc.
References Comm::COMM_ERROR, DBG_CRITICAL, debugs, dummy, fd_table, MYNAME, SQUID_NONBLOCK, TRUE, and xstrerr().
Referenced by Comm::TcpAcceptor::acceptInto(), comm_apply_flags(), comm_open_uds(), DiskdIOStrategy::init(), CommIO::Initialize(), ipcCreate(), logfile_mod_daemon_flush(), Helper::Client::openSessions(), and statefulhelper::openSessions().
◆ commSetReuseAddr()
|
static |
Definition at line 1037 of file comm.cc.
References DBG_IMPORTANT, debugs, MYNAME, and xstrerr().
Referenced by comm_apply_flags(), and comm_open_uds().
◆ commSetTcpRcvbuf()
Definition at line 1047 of file comm.cc.
References DBG_IMPORTANT, debugs, MYNAME, size, and xstrerr().
Referenced by comm_apply_flags(), and comm_open_uds().
◆ commStartHalfClosedMonitor()
void commStartHalfClosedMonitor | ( | int | fd | ) |
The read channel has closed and the caller does not expect more data but needs to detect connection aborts. The current detection method uses 0-length reads: We read until the error occurs or the writer closes the connection. If there is a read error, we close the connection.
Definition at line 1580 of file comm.cc.
References DescriptorSet::add(), assert, commHasHalfClosedMonitor(), commPlanHalfClosedCheck(), CodeContext::Current(), debugs, fd_table, isOpen(), and TheHalfClosed.
Referenced by commMarkHalfClosed().
◆ commStartTlsClose()
|
static |
Definition at line 814 of file comm.cc.
References fd_table, and Security::SessionSendGoodbye().
Referenced by _comm_close().
◆ commStopHalfClosedMonitor()
void commStopHalfClosedMonitor | ( | int const | fd | ) |
Definition at line 1637 of file comm.cc.
References debugs, DescriptorSet::del(), fd_table, Comm::ReadCancel(), and TheHalfClosed.
Referenced by _comm_close(), and comm_read_base().
◆ commUnsetConnTimeout()
int commUnsetConnTimeout | ( | const Comm::ConnectionPointer & | conn | ) |
Definition at line 621 of file comm.cc.
References commSetConnTimeout(), conn, debugs, and Store::nil.
Referenced by IdleConnList::clearHandlers(), Ipc::UdsOp::clearTimeout(), Adaptation::Icap::Xaction::closeConnection(), Http::Tunneler::disconnect(), Security::PeerConnector::disconnect(), Ftp::Channel::forget(), HttpStateData::processReplyBody(), Ftp::Client::readControlReply(), Ftp::Client::scheduleReadControlReply(), Ftp::Client::switchTimeoutToDataChannel(), and Adaptation::Icap::Xaction::updateTimeout().
◆ commUnsetFdTimeout()
void commUnsetFdTimeout | ( | int | fd | ) |
Definition at line 582 of file comm.cc.
References assert, debugs, F(), fd_table, and Squid_MaxFD.
Referenced by _comm_close(), DiskdIOStrategy::init(), ipcCreate(), IcmpSquid::Open(), and unlinkdInit().
◆ commUnsetNonBlocking()
Definition at line 1099 of file comm.cc.
References Comm::COMM_ERROR, DBG_CRITICAL, debugs, dummy, FALSE, fd_table, MYNAME, SQUID_NONBLOCK, and xstrerr().
Referenced by ipc_thread_1(), logfile_mod_daemon_flush(), and unlinkdInit().
◆ ignoreErrno()
Definition at line 1440 of file comm.cc.
Referenced by Comm::TcpAcceptor::acceptInto(), comm_connect_addr(), Ftp::Client::dataRead(), TunnelStateData::Connection::debugLevelForError(), diskHandleRead(), diskHandleWrite(), Comm::DoSelect(), TunnelStateData::Connection::error(), icpHandleUdp(), idnsRead(), logfileHandleWrite(), Ssl::Bio::read(), Ftp::Client::readControlReply(), Comm::ReadNow(), WhoisState::readReply(), and Ssl::Bio::write().
◆ isOpen()
bool isOpen | ( | const int | fd | ) |
Definition at line 88 of file comm.cc.
References fd_table.
Referenced by _comm_close(), Comm::Connection::close(), comm_has_incomplete_write(), comm_init_opened(), comm_open_uds(), comm_read_cancel(), comm_remove_close_handler(), commStartHalfClosedMonitor(), Comm::TcpAcceptor::doAccept(), Comm::MonitorsRead(), Ftp::Server::noteBodyConsumerAborted(), Comm::Connection::noteClosure(), Ftp::Server::noteMoreBodySpaceAvailable(), Http::One::Server::noteMoreBodySpaceAvailable(), Comm::ReadCancel(), Ftp::Server::startWaitingForOrigin(), and Ftp::Server::stopWaitingForOrigin().
◆ limitError()
|
static |
Definition at line 287 of file comm.cc.
Referenced by comm_open_uds(), and comm_openex().
◆ old_comm_reset_close()
void old_comm_reset_close | ( | int | fd | ) |
Definition at line 800 of file comm.cc.
References comm_close, DBG_CRITICAL, debugs, and xstrerr().
Referenced by commCloseAllSockets().
◆ writeTimedOut()
|
static |
Definition at line 1515 of file comm.cc.
References COMMIO_FD_WRITECB, Config, fd_table, squid_curtime, SquidConfig::Timeout, and SquidConfig::write.
Referenced by checkTimeouts().
Variable Documentation
◆ commHalfClosedCheck
|
static |
Definition at line 75 of file comm.cc.
Referenced by commPlanHalfClosedCheck().
◆ commHalfClosedReader
◆ TheHalfClosed
|
static |
Definition at line 73 of file comm.cc.
Referenced by comm_exit(), comm_init(), commHalfClosedCheck(), commHasHalfClosedMonitor(), commPlanHalfClosedCheck(), commStartHalfClosedMonitor(), and commStopHalfClosedMonitor().
◆ WillCheckHalfClosed
|
static |
Definition at line 74 of file comm.cc.
Referenced by commHalfClosedCheck(), and commPlanHalfClosedCheck().