tunneler->setDelayId(entry->mem_obj->mostBytesAllowed());
#endif
httpConnectWait.start(tunneler, callback);
- AsyncJob::Start(tunneler);
- // and wait for the tunnelEstablishmentDone() call
}
/// resumes operations after the (possibly failed) HTTP CONNECT exchange
connector = new Security::BlindPeerConnector(requestPointer, conn, callback, al, sslNegotiationTimeout);
connector->noteFwdPconnUse = true;
encryptionWait.start(connector, callback);
- AsyncJob::Start(connector); // will call our callback
}
/// called when all negotiations with the TLS-speaking peer have been completed
cs->allowPersistent(pconnRace != raceHappened);
destinations->notificationPending = true; // start() is async
tcpConnWait.start(cs, callback);
- AsyncJob::Start(cs);
}
/// send request on an existing connection dedicated to the requesting client
attempt.path = dest; // but not the being-opened conn!
attempt.connWait.start(cs, callConnect);
-
- AsyncJob::Start(cs);
}
/// Comm::ConnOpener callback for the prime connection attempt
const int timeLeft = positiveTimeout(peerTimeout - timeUsed);
const auto connector = new Security::BlindPeerConnector(request, params.conn, callback, nullptr, timeLeft);
encryptionWait.start(connector, callback);
- AsyncJob::Start(connector); // will call our callback
return;
}
AsyncCall::Pointer callback = JobCallback(48, 5, Dialer, this, PeerPoolMgr::handleOpenedConnection);
const auto cs = new Comm::ConnOpener(conn, callback, ctimeout);
connWait.start(cs, callback);
- AsyncJob::Start(cs);
}
void
const auto cs = new Comm::ConnOpener(conn, callback, TheConfig.connect_timeout(service().cfg().bypass));
cs->setHost(s.cfg().host.termedBuf());
connWait.start(cs, callback);
- AsyncJob::Start(cs);
}
/*
const auto sslConnector = new Ssl::IcapPeerConnector(theService, conn, callback, masterLogEntry(), TheConfig.connect_timeout(service().cfg().bypass));
encryptionWait.start(sslConnector, callback);
- AsyncJob::Start(sslConnector); // will call our callback
return;
}
InstanceIdDefinitions(AsyncJob, "job");
-AsyncJob::Pointer AsyncJob::Start(AsyncJob *j)
+void
+AsyncJob::Start(const Pointer &job)
{
- AsyncJob::Pointer job(j);
CallJobHere(93, 5, job, AsyncJob, start);
job->started_ = true; // it is the attempt that counts
- return job;
}
AsyncJob::AsyncJob(const char *aTypeName) :
public:
AsyncJob(const char *aTypeName);
- /// starts a freshly created job (i.e., makes the job asynchronous)
- static Pointer Start(AsyncJob *job);
+ /// Promises to start the configured job (eventually). The job is deemed to
+ /// be running asynchronously beyond this point, so the caller should only
+ /// access the job object via AsyncCalls rather than directly.
+ ///
+ /// swanSong() is only called for jobs for which this method has returned
+ /// successfully (i.e. without throwing).
+ static void Start(const Pointer &job);
protected:
// XXX: temporary method to replace "delete this" in jobs-in-transition.
assert(!job_);
callback_ = aCall;
job_ = aJob;
+
+ AsyncJob::Start(job_.get());
}
void
const auto cs = new Comm::ConnOpener(conn, callback, Config.Timeout.connect);
cs->setHost(data.host);
dataConnWait.start(cs, callback);
- AsyncJob::Start(cs);
}
bool
return !doneWithServer();
}
-AsyncJob::Pointer
+void
Ftp::StartGateway(FwdState *const fwdState)
{
- return AsyncJob::Start(new Ftp::Gateway(fwdState));
+ AsyncJob::Start(new Ftp::Gateway(fwdState));
}
ftpClient->dataComplete();
}
-AsyncJob::Pointer
+void
Ftp::StartRelay(FwdState *const fwdState)
{
- return AsyncJob::Start(new Ftp::Relay(fwdState));
+ AsyncJob::Start(new Ftp::Relay(fwdState));
}
{
/// A new FTP Gateway job
-AsyncJobPointer StartGateway(FwdState *const fwdState);
+void StartGateway(FwdState *const fwdState);
/// A new FTP Relay job
-AsyncJobPointer StartRelay(FwdState *const fwdState);
+void StartRelay(FwdState *const fwdState);
/** Construct an URI with leading / in PATH portion for use by CWD command
* possibly others. FTP encodes absolute paths as beginning with '/'
return false;
}
- Must(AsyncJob::Start(new Rebuild(&dir, stats)));
+ AsyncJob::Start(new Rebuild(&dir, stats));
return true;
}
AsyncCall::Pointer call = commCbCall(30,3, "Ident::ConnectDone", CommConnectCbPtrFun(Ident::ConnectDone, state));
const auto connOpener = new Comm::ConnOpener(identConn, call, Ident::TheConfig.timeout);
state->connWait.start(connOpener, call);
- AsyncJob::Start(connOpener);
}
void
AsyncCall::Pointer call = JobCallback(MY_DEBUG_SECTION, 5, Dialer, this, Log::TcpLogger::connectDone);
const auto cs = new Comm::ConnOpener(futureConn, call, 2);
connWait.start(cs, call);
- AsyncJob::Start(cs);
}
/// Comm::ConnOpener callback
const Downloader *csd = (request ? dynamic_cast<const Downloader*>(request->downloader.valid()) : nullptr);
Downloader *dl = new Downloader(url, certCallback, XactionInitiator::initCertFetcher, csd ? csd->nestedLevel() + 1 : 1);
certDownloadWait.start(dl, certCallback);
- AsyncJob::Start(dl);
}
void
const auto cs = new Comm::ConnOpener(dataConn->cloneProfile(), callback,
Config.Timeout.connect);
dataConnWait.start(cs, callback);
- AsyncJob::Start(cs);
- return false; // ConnStateData::processFtpRequest waits handleConnectDone
+ return false;
}
/// Check that client data connection is ready for immediate I/O.
MyAnswerDialer(&TunnelStateData::noteSecurityPeerConnectorAnswer, this));
const auto connector = new Security::BlindPeerConnector(request, conn, callback, al);
encryptionWait.start(connector, callback);
- AsyncJob::Start(connector); // will call our callback
}
/// starts a preparation step for an established connection; retries on failures
tunneler->setDelayId(server.delayId);
#endif
httpConnectWait.start(tunneler, callback);
- AsyncJob::Start(tunneler);
- // and wait for the tunnelEstablishmentDone() call
}
void
cs->allowPersistent(false);
destinations->notificationPending = true; // start() is async
tcpConnWait.start(cs, callback);
- AsyncJob::Start(cs);
}
/// send request on an existing connection dedicated to the requesting client