MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / internalServiceAttach

Method internalServiceAttach

src/yvalve/why.cpp:6697–6775  ·  view source on GitHub ↗

Attach and probably start a service through the first available subsystem.

Source from the content-addressed store, hash-verified

6695
6696// Attach and probably start a service through the first available subsystem.
6697IService* Dispatcher::internalServiceAttach(CheckStatusWrapper* status, const PathName& svcName,
6698 ClumpletReader& spb, std::function<void(CheckStatusWrapper*, IService*)> start,
6699 IProvider** retProvider)
6700{
6701 IService* service = NULL;
6702
6703 // Build correct config
6704 RefPtr<const Config> config(Config::getDefaultConfig());
6705 if (spb.find(isc_spb_config))
6706 {
6707 string spb_config;
6708 spb.getString(spb_config);
6709 Config::merge(config, &spb_config);
6710 }
6711
6712 FbLocalStatus temp1, temp2;
6713 CheckStatusWrapper* currentStatus = &temp1;
6714
6715 for (GetPlugins<IProvider> providerIterator(IPluginManager::TYPE_PROVIDER, config);
6716 providerIterator.hasData();
6717 providerIterator.next())
6718 {
6719 IProvider* p = providerIterator.plugin();
6720
6721 if (cryptCallback)
6722 {
6723 p->setDbCryptCallback(currentStatus, cryptCallback);
6724 if (currentStatus->getState() & IStatus::STATE_ERRORS)
6725 continue;
6726 }
6727
6728 service = p->attachServiceManager(currentStatus, svcName.c_str(),
6729 spb.getBufferLength(), spb.getBuffer());
6730
6731 if (!(currentStatus->getState() & IStatus::STATE_ERRORS))
6732 {
6733 start(currentStatus, service);
6734
6735 if (!(currentStatus->getState() & IStatus::STATE_ERRORS))
6736 {
6737 fb_utils::copyStatus(status, currentStatus);
6738 if (retProvider)
6739 {
6740 p->addRef();
6741 *retProvider = p;
6742 }
6743
6744 return service;
6745 }
6746 }
6747
6748 switch (currentStatus->getErrors()[1])
6749 {
6750 case isc_service_att_err:
6751 currentStatus = &temp2;
6752 // fall down...
6753 case isc_unavailable:
6754 case isc_wrong_ods:

Callers 1

startMethod · 0.80

Calls 15

copyStatusFunction · 0.85
GdsClass · 0.85
pluginMethod · 0.80
mergeFunction · 0.50
startFunction · 0.50
findMethod · 0.45
getStringMethod · 0.45
hasDataMethod · 0.45
nextMethod · 0.45
setDbCryptCallbackMethod · 0.45
getStateMethod · 0.45
attachServiceManagerMethod · 0.45

Tested by

no test coverage detected