#include "squid.h"#include "base/AsyncFunCalls.h"#include "base/OnOff.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 "compat/socket.h"#include "compat/unistd.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 | commConfigureLinger (int fd, OnOff) | 
| 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... | |
| void | commSetConnTimeout (const Comm::ConnectionPointer &conn, time_t timeout, AsyncCall::Pointer &callback) | 
| void | 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 839 of file comm.cc.
References assert, asyncCall(), callDialer(), fde::_fde_flags::close_request, fde::closing(), 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, FD_FILE, fd_table, fde::flags, fde::_fde_flags::harshClosureRequested, isOpen(), fde::_fde_flags::open, reconfiguring, ScheduleCallHere, BandwidthBucket::SelectBucket(), Comm::SetSelect(), shutting_down, Squid_MaxFD, fde::ssl, and fde::type.
◆ AlreadyTimedOut()
| 
 | static | 
Definition at line 1467 of file comm.cc.
References fde::flags, fde::_fde_flags::open, squid_curtime, and fde::timeout.
Referenced by checkTimeouts().
◆ checkTimeouts()
| void checkTimeouts | ( | void | ) | 
Definition at line 1494 of file comm.cc.
References AlreadyTimedOut(), Biggest_FD, fde::closing(), fde::codeContext, comm_close, Comm::COMM_ERROR, COMM_SELECT_WRITE, COMMIO_FD_WRITECB, debugs, fd_table, Comm::HandleWrite, MessageBucket::quota(), CodeContext::Reset(), ScheduleCallHere, BandwidthBucket::selectWaiting, Comm::SetSelect(), fde::timeoutHandler, fde::writeQuotaHandler, 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 954 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 942 of file comm.cc.
References comm_add_close_handler(), commCbCall(), and debugs.
Referenced by comm_add_close_handler(), Log::TcpLogger::connectDone(), Comm::ConnOpener::createFd(), Snmp::Forwarder::Forwarder(), Mgr::Forwarder::Forwarder(), HttpStateData::HttpStateData(), idnsInitVCConnected(), TunnelStateData::Connection::initConnection(), Mgr::Inquirer::Inquirer(), Snmp::Inquirer::Inquirer(), Ftp::Channel::opened(), Helper::Client::openSessions(), statefulhelper::openSessions(), Security::PeerConnector::PeerConnector(), ConnStateData::pinConnection(), Comm::TcpAcceptor::setListen(), ConnStateData::start(), Mgr::StoreToCommWriter::StoreToCommWriter(), 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 472 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(), commConfigureLinger(), commSetBindAddressNoPort(), commSetCloseOnExec(), commSetNonBlocking(), commSetReuseAddr(), commSetTcpRcvbuf(), Config, DBG_CRITICAL, DBG_IMPORTANT, debugs, Ip::Address::isAnyAddr(), Ip::Address::isNoAddr(), off, Comm::OK, on, opt_reuseaddr, Ip::Address::port(), reconfiguring, SquidConfig::tcpRcvBufsz, TexcHere, ToSBuf(), xsetsockopt(), and xstrerr().
Referenced by comm_openex().
◆ comm_close_complete()
| 
 | static | 
Definition at line 813 of file comm.cc.
References fd_close(), fd_table, Comm::AcceptLimiter::Instance(), Comm::AcceptLimiter::kick(), CodeContext::Reset(), StatCounters::sock, statCounter, StatCounters::syscalls, and xclose().
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 631 of file comm.cc.
References assert, fde::_fde_flags::called_connect, Comm::COMM_ERROR, DBG_DATA, debugs, Comm::ERR_PROTOCOL, fd_table, fde::flags, Ip::Address::FreeAddr(), Ip::Address::getAddrInfo(), ignoreErrno(), Comm::INPROGRESS, fde::ipaddr, Ip::Address::isIPv4(), fde::local_addr, MAX_IPSTRLEN, Comm::OK, Ip::Address::port(), fde::remote_port, StatCounters::sock, fde::sock_family, statCounter, StatCounters::syscalls, Ip::Address::toStr(), xconnect(), xgetsockopt(), 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 105 of file comm.cc.
References FD_MSGHDR, FD_READ_METHOD(), and fd_table.
Referenced by _comm_close().
◆ comm_exit()
| void comm_exit | ( | void | ) | 
◆ comm_has_incomplete_write()
| bool comm_has_incomplete_write | ( | int | fd | ) | 
Definition at line 154 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 551 of file comm.cc.
References assert, comm_init_opened(), COMM_NONBLOCKING, COMM_TRANSPARENT, debugs, fd_table, and Comm::IsConnOpen().
Referenced by Ipc::ImportFdIntoComm(), and Ipc::SharedListenJoined().
◆ comm_init()
| void comm_init | ( | void | ) | 
Definition at line 1141 of file comm.cc.
References assert, fd_table, min(), RESERVED_FD, Comm::SelectLoopInit(), Squid_MaxFD, and TheHalfClosed.
Referenced by TestUfs::commonInit(), and SquidMain().
◆ comm_init_opened()
| 
 | static | 
Definition at line 450 of file comm.cc.
References assert, debugs, fd_open(), FD_SOCKET, fd_table, Comm::IsConnOpen(), isOpen(), fde::local_addr, and fde::sock_family.
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 167 of file comm.cc.
References DBG_IMPORTANT, debugs, fd_table, fde::flags, Ip::Address::FreeAddr(), Ip::Address::InitAddr(), Ip::Address::isAnyAddr(), fde::local_addr, MYNAME, fde::_fde_flags::open, Ip::Address::port(), Ip::Address::setIPv4(), fde::sock_family, xgetsockname(), 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 245 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 259 of file comm.cc.
References COMM_DOBIND, and comm_openex().
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 272 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 1677 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, statCounter, SUN_LEN, sockaddr_un::sun_path, StatCounters::syscalls, SquidConfig::tcpRcvBufsz, xsocket(), 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 358 of file comm.cc.
References comm_apply_flags(), comm_init_opened(), comm_set_v6only(), 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, statCounter, StatCounters::syscalls, xsocket(), 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 1000 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 971 of file comm.cc.
References assert, debugs, fd_table, isOpen(), and AsyncCall::Next().
Referenced by 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(), Snmp::Forwarder::swanSong(), Mgr::Forwarder::swanSong(), Comm::TcpAcceptor::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 787 of file comm.cc.
References commConfigureLinger(), debugs, Comm::IsConnOpen(), and on.
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 315 of file comm.cc.
References DBG_CRITICAL, DBG_IMPORTANT, debugs, enter_suid(), fd_table, leave_suid(), MYNAME, xsetsockopt(), and xstrerr().
Referenced by comm_apply_flags().
◆ comm_set_v6only()
Definition at line 296 of file comm.cc.
References DBG_CRITICAL, DBG_IMPORTANT, debugs, MYNAME, xsetsockopt(), and xstrerr().
Referenced by comm_openex().
◆ comm_udp_recv()
Definition at line 141 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 128 of file comm.cc.
References debugs, Ip::Address::FreeAddr(), Ip::Address::InitAddr(), StatCounters::sock, statCounter, StatCounters::syscalls, and xrecvfrom().
Referenced by comm_udp_recv(), htcpRecv(), icpHandleUdp(), idnsRead(), snmpHandleUdp(), wccp2HandleUdp(), and wccpHandleUdp().
◆ comm_udp_send()
Definition at line 148 of file comm.cc.
References xsend().
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 911 of file comm.cc.
References Comm::COMM_ERROR, comm_local_port(), DBG_IMPORTANT, debugs, fd_table, Ip::Address::FreeAddr(), Ip::Address::getAddrInfo(), MYNAME, StatCounters::sock, statCounter, StatCounters::syscalls, xsendto(), and xstrerr().
Referenced by htcpSend(), icpUdpSend(), idnsSendQuery(), Snmp::Forwarder::sendError(), Snmp::Inquirer::sendResponse(), snmpConstructReponse(), wccp2AssignBuckets(), and wccp2HereIam().
◆ commBind()
| 
 | static | 
Definition at line 226 of file comm.cc.
References Comm::COMM_ERROR, DBG_CRITICAL, debugs, fd_table, MYNAME, Comm::OK, StatCounters::sock, statCounter, StatCounters::syscalls, xbind(), and xstrerr().
Referenced by comm_apply_flags(), and comm_open_uds().
◆ commCallCloseHandlers()
| void commCallCloseHandlers | ( | int | fd | ) | 
Definition at line 744 of file comm.cc.
References AsyncCall::canceled(), fde::closeHandler, debugs, fd_table, AsyncCall::Next(), ScheduleCallHere, and AsyncCall::setNext().
Referenced by _comm_close(), and examine_select().
◆ commCloseAllSockets()
| void commCloseAllSockets | ( | void | ) | 
Definition at line 1437 of file comm.cc.
References Biggest_FD, debugs, FD_SOCKET, fd_table, fde::flags, fde::_fde_flags::ipc, old_comm_reset_close(), fde::_fde_flags::open, ScheduleCallHere, fde::timeoutHandler, and fde::type.
Referenced by SquidShutdown().
◆ commConfigureLinger()
sets SO_LINGER socket(7) option
- Parameters
- 
  enabled – whether linger will be active (sets linger::l_onoff) 
Definition at line 768 of file comm.cc.
References DBG_CRITICAL, debugs, fd_table, on, xsetsockopt(), and xstrerr().
Referenced by comm_apply_flags(), comm_reset_close(), and old_comm_reset_close().
◆ 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 1570 of file comm.cc.
References DescriptorSet::begin(), CallBack(), commPlanHalfClosedCheck(), DescriptorSet::const_iterator, debugs, DescriptorSet::end(), fd_table, TheHalfClosed, and WillCheckHalfClosed.
◆ commHalfClosedReader()
| 
 | static | 
Definition at line 1619 of file comm.cc.
References assert, commHasHalfClosedMonitor(), commPlanHalfClosedCheck(), debugs, Comm::ERR_CLOSING, fd_table, Comm::OK, and size.
◆ commHandleWriteHelper()
| 
 | static | 
Definition at line 1167 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 1597 of file comm.cc.
References DescriptorSet::has(), and TheHalfClosed.
Referenced by _comm_close(), commHalfClosedReader(), commIsHalfClosed(), and commStartHalfClosedMonitor().
◆ commPlanHalfClosedCheck()
| 
 | static | 
Definition at line 1558 of file comm.cc.
References commHalfClosedCheck, 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 212 of file comm.cc.
References DBG_IMPORTANT, debugs, xsetsockopt(), and xstrerr().
Referenced by comm_apply_flags().
◆ commSetCloseOnExec()
| void commSetCloseOnExec | ( | int | fd | ) | 
On platforms where FD_CLOEXEC is defined, close the given descriptor during a function call from the exec(3) family. Otherwise, do nothing; the platform itself may close-on-exec by default (e.g., MS Win32 is said to do that at https://devblogs.microsoft.com/oldnewthing/20111216-00/?p=8873); other platforms are unsupported. Callers that want close-on-exec behavior must call this function on all platforms and are not responsible for the outcome on platforms without FD_CLOEXEC.
Definition at line 1105 of file comm.cc.
References assert, DBG_CRITICAL, debugs, dummy, MYNAME, and xstrerr().
Referenced by comm_apply_flags(), and comm_open_uds().
◆ commSetConnTimeout()
| void commSetConnTimeout | ( | const Comm::ConnectionPointer & | , | 
| time_t | seconds, | ||
| AsyncCall::Pointer & | |||
| ) | 
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 594 of file comm.cc.
References assert, debugs, fd_table, fde::flags, Comm::IsConnOpen(), fde::_fde_flags::open, squid_curtime, Squid_MaxFD, fde::timeout, and fde::timeoutHandler.
Referenced by 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(), TunnelStateData::TunnelStateData(), Adaptation::Icap::Xaction::updateTimeout(), and whoisStart().
◆ commSetNonBlocking()
Definition at line 1044 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 1015 of file comm.cc.
References DBG_IMPORTANT, debugs, MYNAME, on, xsetsockopt(), and xstrerr().
Referenced by comm_apply_flags(), and comm_open_uds().
◆ commSetTcpRcvbuf()
Definition at line 1025 of file comm.cc.
References DBG_IMPORTANT, debugs, MYNAME, size, xsetsockopt(), 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 1547 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 807 of file comm.cc.
References fd_table, and Security::SessionSendGoodbye().
Referenced by _comm_close().
◆ commStopHalfClosedMonitor()
| void commStopHalfClosedMonitor | ( | int const | fd | ) | 
Definition at line 1604 of file comm.cc.
References debugs, DescriptorSet::del(), fd_table, Comm::ReadCancel(), and TheHalfClosed.
Referenced by _comm_close(), and comm_read_base().
◆ commUnsetConnTimeout()
| void commUnsetConnTimeout | ( | const Comm::ConnectionPointer & | conn | ) | 
Definition at line 618 of file comm.cc.
References commSetConnTimeout(), and debugs.
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 581 of file comm.cc.
References assert, debugs, fd_table, fde::flags, fde::_fde_flags::open, Squid_MaxFD, fde::timeout, and fde::timeoutHandler.
Referenced by _comm_close(), DiskdIOStrategy::init(), ipcCreate(), IcmpSquid::Open(), and unlinkdInit().
◆ commUnsetNonBlocking()
Definition at line 1077 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 1407 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 91 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(), Http::One::Server::noteMoreBodySpaceAvailable(), Ftp::Server::noteMoreBodySpaceAvailable(), Comm::ReadCancel(), Ftp::Server::startWaitingForOrigin(), and Ftp::Server::stopWaitingForOrigin().
◆ limitError()
| 
 | static | 
Definition at line 290 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 798 of file comm.cc.
References comm_close, commConfigureLinger(), and on.
Referenced by commCloseAllSockets().
◆ writeTimedOut()
| 
 | static | 
Definition at line 1482 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 78 of file comm.cc.
Referenced by commPlanHalfClosedCheck().
◆ commHalfClosedReader
◆ TheHalfClosed
| 
 | static | 
Definition at line 76 of file comm.cc.
Referenced by comm_exit(), comm_init(), commHalfClosedCheck(), commHasHalfClosedMonitor(), commPlanHalfClosedCheck(), commStartHalfClosedMonitor(), and commStopHalfClosedMonitor().
◆ WillCheckHalfClosed
| 
 | static | 
Definition at line 77 of file comm.cc.
Referenced by commHalfClosedCheck(), and commPlanHalfClosedCheck().
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
