8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 21:23:04 +01:00
This commit is contained in:
asfernandes 2011-01-16 02:16:15 +00:00
parent 24b28d8831
commit 233093cee4
21 changed files with 62 additions and 79 deletions

View File

@ -356,7 +356,7 @@
#
# Type: string
# AuthServer and AuthClient determine what uthentication methods will be used
# AuthServer and AuthClient determine what authentication methods will be used
# by network server and client redirector. For non-windows systems default
# for both is Legacy_Auth.
#

View File

@ -43,7 +43,7 @@ to callback function. Call mask can have the following values:
fb_shut_confirmation - callback function may return non-zero value to abort shutdown
fb_shut_preproviders - callback function will be called before shutting down engine
fb_shut_postproviders - callback function will be called after shutting down engine
fb_shut_finish - final step, callback function may wait for some activity to be treminated
fb_shut_finish - final step, callback function may wait for some activity to be terminated
or ORed combination of them (to make same function be called in required cases).
Callback function has 3 parameters - reason of shutdown, actual value of mask with which it was

View File

@ -37,8 +37,6 @@
#include "../common/isc_s_proto.h"
#include "../common/gdsassert.h"
#ifdef WIN_NT
#include <process.h>
#include <windows.h>
@ -139,7 +137,6 @@ void Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, Handl
pthread_attr_t pattr;
int state;
#if defined (LINUX) || defined (FREEBSD)
if (state = pthread_create(&thread, NULL, THREAD_ENTRYPOINT, THREAD_ARG))
Firebird::system_call_failed::raise("pthread_create", state);

View File

@ -261,7 +261,7 @@ private:
void getPlugin()
{
currentPlugin = (P*)(pluginSet->plugin());
currentPlugin = (P*) pluginSet->plugin();
}
};

View File

@ -779,10 +779,8 @@ UnicodeUtil::ICU* UnicodeUtil::loadICU(const Firebird::string& icuVersion,
ObjectsArray<string> versions;
getVersions(configInfo, versions);
if (!versions.getCount())
{
if (versions.isEmpty())
gds__log("No versions");
}
string version = icuVersion.isEmpty() ? versions[0] : icuVersion;
if (version == "default")

View File

@ -659,7 +659,7 @@ When engine is released, it does dlclose() plugin module (libudr_engine.so),
but that module is not actually unloaded - because UDR module (libudrcpp_example.so) is using
symbols from plugin module, therefore raising plugin module's reference count.
UDR module can be unloaded only from plugin module's global variable (ModuleMap modules) dtor,
which is not called as long as plugin module is not inloaded. As the result all this will be
which is not called as long as plugin module is not unloaded. As the result all this will be
unloaded only on program exit, causing at that moment AV if this code is active: it happens that
~ModuleMap dlcloses itself.

View File

@ -2592,20 +2592,10 @@ static void move_to_string(thread_db* tdbb, dsc* fromDesc, dsc* toDesc)
}
// Release a blob and associated blocks. Among other things, disconnect it from the transaction.
// However, if purge_flag is false, then only release the associated blocks.
void blb::destroy(blb* blob, const bool purge_flag)
{
/**************************************
*
* r e l e a s e _ b l o b
*
**************************************
*
* Functional description
* Release a blob and associated blocks. Among other things,
* disconnect it from the transaction. However, if purge_flag
* is false, then only release the associated blocks.
*
**************************************/
jrd_tra* const transaction = blob->blb_transaction;
// Disconnect blob from transaction block.
@ -2646,7 +2636,7 @@ void blb::destroy(blb* blob, const bool purge_flag)
blob->blb_transaction->getBlobSpace()->releaseSpace(blob->blb_temp_offset, blob->blb_temp_size);
}
--(blob->refCounter);
--blob->refCounter;
delete blob;
}

View File

@ -3725,7 +3725,8 @@ void Provider::shutdown(Status* status, unsigned int timeout, const int /*reason
try
{
CounterGuard guard(shutCounter);
/*
/***
if (unloading)
{
return;
@ -3738,7 +3739,8 @@ void Provider::shutdown(Status* status, unsigned int timeout, const int /*reason
{
return;
}
*/
***/
ThreadContextHolder tdbb;
ULONG attach_count, database_count, svc_count;

View File

@ -194,11 +194,10 @@ public:
{
if (transaction)
{
--(transaction->refCounter);
--transaction->refCounter;
if (!dbb || transaction->tra_outer)
{
delete transaction;
}
else
{
MemoryPool* const pool = transaction->tra_pool;

View File

@ -53,6 +53,7 @@ namespace
virtual int FB_CARG noEvent()
{
static bool flagFirst = true;
if (flagFirst)
{
flagFirst = false;
@ -241,7 +242,7 @@ void TraceManager::update_session(const TraceSession& session)
}
}
for (FactoryInfo* info = factories->begin(); info < factories->end(); ++info)
for (FactoryInfo* info = factories->begin(); info != factories->end(); ++info)
{
TraceInitInfoImpl attachInfo(session, attachment, filename);
LocalStatus status;

View File

@ -150,21 +150,23 @@ private:
TraceFactory* factory;
char name[MAXPATHLEN];
};
class Factories : public Firebird::Array<FactoryInfo>
{
public:
Factories(Firebird::MemoryPool& p)
: Firebird::Array<FactoryInfo>(p)
{ }
~Factories()
{
Firebird::PluginInterface pi;
for (unsigned int i = 0; i < getCount(); ++i)
{
pi->releasePlugin(getElement(i).factory);
}
}
};
static Firebird::GlobalPtr<Factories> factories;
static Firebird::GlobalPtr<Firebird::Mutex> init_factories_mtx;
static volatile bool init_factories;

View File

@ -90,13 +90,16 @@ public:
{
// this plugin is not ready to support different configurations
// therefore keep legacy approach
IConfigParameter* icp = NULL;
for (int n = 0; (icp = defaultConfig->findPos("path", n)); ++n)
{
PathName newPath(icp->value());
icp->release();
bool found = false;
for (ObjectsArray<PathName>::iterator i = paths->begin(); i != paths->end(); ++i)
{
if (*i == newPath)
@ -779,7 +782,7 @@ void FB_CALL Engine::dispose(Error* /*error*/)
//--------------------------------------
/*
/***
class ExternalEngineFactoryImpl : public ExternalEngineFactory
{
public:
@ -796,7 +799,8 @@ public:
error->addString(msg, strlen(msg));
return NULL;
}
*/
***/
class ExternalEngineFactoryImpl : public SimpleFactory<Engine>
{
} factory;
@ -807,7 +811,8 @@ extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
Firebird::IPlugin* plugin = master->getPluginInterface();
plugin->registerPlugin(Firebird::PluginType::ExternalEngine, "UDR", &factory);
plugin->release();
/*
/***
if (plugin->getLibraryName())
libraryName->assign(plugin->getLibraryName());
libraryModule = ModuleLoader::loadModule(libraryName);
@ -823,7 +828,7 @@ extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master)
}
plugin->setExternalEngineFactory(&factory);
*/
***/
}

View File

@ -165,9 +165,8 @@ int Blob::release()
cancel(&status);
}
else
{
delete this;
}
return 0;
}
@ -209,10 +208,12 @@ public:
public:
Transaction(Rtr* handle) : transaction(handle) { }
Rtr* getTransaction()
{
return transaction;
}
void clear()
{
transaction = NULL;
@ -226,9 +227,7 @@ private:
int Transaction::release()
{
if (--refCounter != 0)
{
return 1;
}
if (transaction)
{
@ -236,9 +235,7 @@ int Transaction::release()
rollback(&status);
}
else
{
delete this;
}
return 0;
}
@ -287,9 +284,7 @@ private:
int Statement::release()
{
if (--refCounter != 0)
{
return 1;
}
if (statement)
{
@ -297,9 +292,7 @@ int Statement::release()
free(&status, DSQL_drop);
}
else
{
delete this;
}
return 0;
}
@ -331,9 +324,7 @@ private:
int Request::release()
{
if (--refCounter != 0)
{
return 1;
}
if (rq)
{
@ -341,9 +332,7 @@ int Request::release()
free(&status);
}
else
{
delete this;
}
return 0;
}
@ -364,9 +353,7 @@ private:
int Events::release()
{
if (--refCounter != 0)
{
return 1;
}
if (rvnt)
{
@ -374,9 +361,7 @@ int Events::release()
cancel(&status);
}
else
{
delete this;
}
return 0;
}
@ -410,6 +395,7 @@ public:
public:
Attachment(Rdb* handle) : rdb(handle) { }
Rdb* getRdb()
{
return rdb;
@ -422,9 +408,7 @@ private:
int Attachment::release()
{
if (--refCounter != 0)
{
return 1;
}
if (rdb)
{
@ -432,9 +416,7 @@ int Attachment::release()
detach(&status);
}
else
{
delete this;
}
return 0;
}
@ -461,9 +443,7 @@ private:
int Service::release()
{
if (--refCounter != 0)
{
return 1;
}
if (rdb)
{
@ -471,9 +451,7 @@ int Service::release()
detach(&status);
}
else
{
delete this;
}
return 0;
}
@ -502,6 +480,7 @@ public:
delete this;
return 0;
}
return 1;
}

View File

@ -28,7 +28,10 @@
#ifndef REMOTE_CLIENT_INTERFACE_H
#define REMOTE_CLIENT_INTERFACE_H
namespace Remote {
namespace Remote
{
void registerRedirector(Firebird::IPlugin* iPlugin);
}
#endif // REMOTE_CLIENT_INTERFACE_H

View File

@ -54,6 +54,7 @@ public:
~PluginLogWriter();
virtual size_t write(const void* buf, size_t size);
virtual int release()
{
if (--refCounter == 0)

View File

@ -96,7 +96,7 @@ void FB_CARG MasterImplementation::upgradeInterface(Interface* toUpgrade,
CVirtualClass* target = (CVirtualClass*) toUpgrade;
FunctionPtr* newTab = NULL;
if (!functionMap->get((U_IPTR)(target->vTab), newTab))
if (!functionMap->get((U_IPTR) target->vTab, newTab))
{
CVirtualClass* miss = (CVirtualClass*) missingFunctionClass;
newTab = FB_NEW(*getDefaultMemoryPool()) FunctionPtr[desiredVersion];
@ -106,7 +106,7 @@ void FB_CARG MasterImplementation::upgradeInterface(Interface* toUpgrade,
for (int j = toUpgrade->version(); j < desiredVersion; ++j)
newTab[j] = miss->vTab[0];
functionMap->put((U_IPTR)(target->vTab), newTab);
functionMap->put((U_IPTR) target->vTab, newTab);
}
target->vTab = newTab;

View File

@ -142,12 +142,12 @@ namespace
if (--refCounter == 0)
{
if (cf)
{
cf->release();
}
delete this;
return 0;
}
return 1;
}
@ -200,6 +200,7 @@ namespace
delete this;
return 0;
}
return 1;
}
@ -213,6 +214,7 @@ namespace
addRef();
return new ConfigParameterAccess(this, p);
}
return NULL;
}
};
@ -220,9 +222,8 @@ namespace
IConfig* ConfigParameterAccess::sub()
{
if (par && par->sub.hasData())
{
return new ConfigAccess(par->sub);
}
return NULL;
}
@ -231,6 +232,7 @@ namespace
RegisteredPlugin(PluginsFactory* f, const char* nm, unsigned int t)
: factory(f), name(nm), type(t)
{ }
RegisteredPlugin()
: factory(NULL), name(NULL), type(0)
{ }
@ -364,6 +366,7 @@ namespace
delete this;
return 0;
}
return 1;
}
@ -495,6 +498,7 @@ namespace
delete this;
return 0;
}
return 1;
}
@ -509,6 +513,7 @@ namespace
AutoPtr<IMaster, AutoInterface> masterInterface;
RefPtr<PluginModule> loadModule(const PathName& modName);
void loadError(const Arg::StatusVector& error)
{
iscLogStatus("PluginSet", error.value());
@ -586,7 +591,7 @@ namespace
currentPlugin = new ConfiguredPlugin(m, r, conf, plugConfigFile, currentName);
currentPlugin->release(); // std interface is created with refCounter == 1
// cause currentPlugin holds refernce itself, that 1 should be released() here
// cause currentPlugin holds reference itself, that 1 should be released() here
plugins->put(MapKey(interfaceType, currentName), currentPlugin);
return;
@ -698,6 +703,7 @@ void FB_CARG PluginManager::releasePlugin(Plugin* plugin)
MutexLockGuard g(plugins->mutex);
Interface* parent = plugin->owner(NULL);
if (plugin->release() == 0)
{
fb_assert(parent);