attempts to send an IPC message a few times, with a timeout More...

#include <UdsOp.h>

Inheritance diagram for Ipc::UdsSender:
Collaboration diagram for Ipc::UdsSender:

Public Types

typedef CbcPointer< AsyncJobPointer
 

Public Member Functions

 UdsSender (const String &pathAddr, const TypedMsgHdr &aMessage)
 
bool canBeCalled (AsyncCall &call) const
 whether we can be called More...
 
void callStart (AsyncCall &call)
 
virtual void callEnd ()
 called right after the called job method More...
 
virtual void callException (const std::exception &e)
 called when the job throws during an async call More...
 
virtual void * toCbdata ()=0
 

Static Public Member Functions

static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...
 

Public Attributes

struct sockaddr_un address
 UDS address from path; treat as read-only. More...
 

Protected Member Functions

virtual void swanSong ()
 
virtual void start ()
 called by AsyncStart; do not call directly More...
 
virtual bool doneAll () const
 whether positive goal has been reached More...
 
virtual void timedout ()
 called after setTimeout() if timed out More...
 
Comm::ConnectionPointerconn ()
 creates if needed and returns raw UDS socket descriptor More...
 
void setTimeout (int seconds, const char *handlerName)
 call timedout() if no UDS messages in a given number of seconds More...
 
void clearTimeout ()
 remove previously set timeout, if any More...
 
void setOptions (int newOptions)
 changes socket options More...
 
void deleteThis (const char *aReason)
 
void mustStop (const char *aReason)
 
bool done () const
 the job is destroyed in callEnd() when done() More...
 
virtual const char * status () const
 internal cleanup; do not call directly More...
 

Protected Attributes

const char * stopReason
 reason for forcing done() to be true More...
 
const char * typeName
 kid (leaf) class name, for debugging More...
 
AsyncCall::Pointer inCall
 the asynchronous call being handled, if any More...
 
const InstanceId< AsyncJobid
 job identifier More...
 

Private Member Functions

 CBDATA_CLASS (UdsSender)
 
void startSleep ()
 pause for a while before resending the message More...
 
void cancelSleep ()
 stop sleeping (or do nothing if we were not) More...
 
void delayedRetry ()
 make another sending attempt after a pause More...
 
void write ()
 schedule writing More...
 
void wrote (const CommIoCbParams &params)
 done writing or error More...
 
 UdsSender (const UdsSender &)
 
UdsSenderoperator= (const UdsSender &)
 

Static Private Member Functions

static void DelayedRetry (void *data)
 legacy wrapper for Ipc::UdsSender::delayedRetry() More...
 

Private Attributes

TypedMsgHdr message
 what to send More...
 
int retries
 how many times to try after a write error More...
 
int timeout
 total time to send the message More...
 
bool sleeping
 whether we are waiting to retry a failed write More...
 
bool writing
 whether Comm started and did not finish writing More...
 

Detailed Description

Definition at line 67 of file UdsOp.h.

Member Typedef Documentation

◆ Pointer

Definition at line 34 of file AsyncJob.h.

Constructor & Destructor Documentation

◆ UdsSender() [1/2]

Ipc::UdsSender::UdsSender ( const String pathAddr,
const TypedMsgHdr aMessage 
)

Definition at line 84 of file UdsOp.cc.

References Ipc::UdsOp::address, Ipc::TypedMsgHdr::address(), and message.

Referenced by Ipc::SendMessage().

◆ UdsSender() [2/2]

Ipc::UdsSender::UdsSender ( const UdsSender )
private

Member Function Documentation

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)
inherited

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 101 of file AsyncJob.cc.

References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.

Referenced by AsyncJob::swanSong().

◆ cancelSleep()

void Ipc::UdsSender::cancelSleep ( )
private

Definition at line 149 of file UdsOp.cc.

References debugs, and sleeping.

Referenced by swanSong().

◆ CBDATA_CLASS()

Ipc::UdsSender::CBDATA_CLASS ( UdsSender  )
private

◆ clearTimeout()

void Ipc::UdsOp::clearTimeout ( )
protectedinherited

◆ conn()

◆ DelayedRetry()

void Ipc::UdsSender::DelayedRetry ( void *  data)
staticprivate

Definition at line 159 of file UdsOp.cc.

References assert, data, delayedRetry(), JobCallback, ScheduleCallHere, and CbcPointer< Cbc >::valid().

Referenced by startSleep().

◆ delayedRetry()

void Ipc::UdsSender::delayedRetry ( )
private

Definition at line 173 of file UdsOp.cc.

References debugs, HERE(), sleeping, and write().

Referenced by DelayedRetry().

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)
protectedinherited

◆ done()

◆ doneAll()

bool Ipc::UdsSender::doneAll ( ) const
protectedvirtual

Reimplemented from AsyncJob.

Definition at line 112 of file UdsOp.cc.

References AsyncJob::doneAll(), sleeping, and writing.

◆ mustStop()

void AsyncJob::mustStop ( const char *  aReason)
protectedinherited

Definition at line 69 of file AsyncJob.cc.

References debugs, AsyncJob::inCall, Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.

Referenced by HttpStateData::abortAll(), Ftp::Client::abortAll(), Comm::TcpAcceptor::acceptOne(), Adaptation::Ecap::XactionRep::adaptationAborted(), Adaptation::AccessCheck::callBack(), AsyncJob::callException(), Security::PeerConnector::connectionClosed(), HttpStateData::continueAfterParsingHeader(), Ftp::Client::ctrlClosed(), Adaptation::Iterator::handleAdaptationBlock(), Adaptation::Iterator::handleAdaptationError(), Log::TcpLogger::handleClosure(), Adaptation::Icap::Xaction::handleCommClosed(), Http::Tunneler::handleConnectionClosure(), Mgr::Forwarder::handleError(), Ipc::Forwarder::handleError(), Ipc::Forwarder::handleException(), Ipc::Inquirer::handleException(), HttpStateData::handleMoreRequestBodyAvailable(), Ipc::Inquirer::handleRemoteAck(), Ipc::Forwarder::handleTimeout(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), Comm::ConnOpener::noteAbort(), Adaptation::Icap::ModXact::noteBodyConsumerAborted(), Snmp::Forwarder::noteCommClosed(), Snmp::Inquirer::noteCommClosed(), Mgr::Inquirer::noteCommClosed(), Mgr::Forwarder::noteCommClosed(), Mgr::StoreToCommWriter::noteCommClosed(), Adaptation::Icap::Xaction::noteCommRead(), Rock::HeaderUpdater::noteDoneReading(), Adaptation::Iterator::noteInitiatorAborted(), Adaptation::Icap::Xaction::noteInitiatorAborted(), Adaptation::Ecap::XactionRep::noteInitiatorAborted(), HttpStateData::readReply(), Comm::ConnOpener::sendAnswer(), Rock::Rebuild::start(), Security::PeerConnector::start(), HttpStateData::start(), timedout(), and HttpStateData::wroteLast().

◆ operator=()

UdsSender& Ipc::UdsSender::operator= ( const UdsSender )
private

◆ setOptions()

void Ipc::UdsOp::setOptions ( int  newOptions)
protectedinherited

Definition at line 35 of file UdsOp.cc.

References Ipc::UdsOp::options.

Referenced by Ipc::Port::Port(), and Ipc::UdsOp::timedout().

◆ setTimeout()

void Ipc::UdsOp::setTimeout ( int  seconds,
const char *  handlerName 
)
protectedinherited

◆ Start()

◆ start()

void Ipc::UdsSender::start ( )
protectedvirtual

Reimplemented from AsyncJob.

Definition at line 104 of file UdsOp.cc.

References Ipc::UdsOp::setTimeout(), AsyncJob::start(), timeout, and write().

◆ startSleep()

void Ipc::UdsSender::startSleep ( )
private

Definition at line 139 of file UdsOp.cc.

References DelayedRetry(), eventAdd(), Must, and sleeping.

Referenced by wrote().

◆ status()

◆ swanSong()

void Ipc::UdsSender::swanSong ( )
protectedvirtual

Reimplemented from AsyncJob.

Definition at line 95 of file UdsOp.cc.

References cancelSleep(), sleeping, and AsyncJob::swanSong().

◆ timedout()

void Ipc::UdsSender::timedout ( )
protectedvirtual

Reimplemented from Ipc::UdsOp.

Definition at line 182 of file UdsOp.cc.

References debugs, HERE(), and AsyncJob::mustStop().

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

◆ write()

void Ipc::UdsSender::write ( )
private

◆ wrote()

void Ipc::UdsSender::wrote ( const CommIoCbParams params)
private

Member Data Documentation

◆ address

struct sockaddr_un Ipc::UdsOp::address
inherited

Definition at line 36 of file UdsOp.h.

Referenced by Ipc::UdsOp::conn(), and UdsSender().

◆ id

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 72 of file AsyncJob.h.

◆ inCall

◆ message

TypedMsgHdr Ipc::UdsSender::message
private

Definition at line 90 of file UdsOp.h.

Referenced by UdsSender(), and write().

◆ retries

int Ipc::UdsSender::retries
private

Definition at line 91 of file UdsOp.h.

Referenced by wrote().

◆ sleeping

bool Ipc::UdsSender::sleeping
private

Definition at line 93 of file UdsOp.h.

Referenced by cancelSleep(), delayedRetry(), doneAll(), startSleep(), and swanSong().

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ timeout

int Ipc::UdsSender::timeout
private

Definition at line 92 of file UdsOp.h.

Referenced by start().

◆ typeName

◆ writing

bool Ipc::UdsSender::writing
private

Definition at line 94 of file UdsOp.h.

Referenced by doneAll(), write(), and wrote().


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors