mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 08:03:04 +01:00
Fixed CORE-6441: Srp plugin keeps connection after database has been removed for ~10 seconds (SS and SC)
This commit is contained in:
parent
500758f7af
commit
b4386db63b
@ -71,13 +71,23 @@ void PluginDatabases::getInstance(IPluginConfig* pluginConfig, RefPtr<CachedSecu
|
|||||||
|
|
||||||
{ // guard scope
|
{ // guard scope
|
||||||
MutexLockGuard g(arrayMutex, FB_FUNCTION);
|
MutexLockGuard g(arrayMutex, FB_FUNCTION);
|
||||||
for (unsigned int i = 0; i < dbArray.getCount(); ++i)
|
for (unsigned int i = 0; i < dbArray.getCount(); )
|
||||||
{
|
{
|
||||||
if (secDbName == dbArray[i]->secureDbName)
|
if (secDbName == dbArray[i]->secureDbName)
|
||||||
{
|
{
|
||||||
instance = dbArray[i];
|
CachedSecurityDatabase* fromCache = dbArray[i];
|
||||||
break;
|
if (fromCache->secDb->test())
|
||||||
|
{
|
||||||
|
instance = fromCache;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dbArray.remove(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instance)
|
if (!instance)
|
||||||
@ -147,7 +157,7 @@ void PluginDatabases::handler(CachedSecurityDatabase* tgt)
|
|||||||
const ISC_STATUS* status = st.begin();
|
const ISC_STATUS* status = st.begin();
|
||||||
if (status[0] == 1 && status[1] != isc_att_shutdown)
|
if (status[0] == 1 && status[1] != isc_att_shutdown)
|
||||||
{
|
{
|
||||||
iscLogStatus("Legacy security database timer handler", status);
|
iscLogStatus("Security database timer handler", status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool lookup(void* inMsg, void* outMsg) = 0;
|
virtual bool lookup(void* inMsg, void* outMsg) = 0;
|
||||||
|
virtual bool test() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +109,8 @@ protected:
|
|||||||
class SecurityDatabase : public VSecDb
|
class SecurityDatabase : public VSecDb
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool lookup(void* inMsg, void* outMsg)
|
// VSecDb implementation
|
||||||
|
bool lookup(void* inMsg, void* outMsg) override
|
||||||
{
|
{
|
||||||
FbLocalStatus status;
|
FbLocalStatus status;
|
||||||
|
|
||||||
@ -120,6 +121,14 @@ public:
|
|||||||
return false; // safe default
|
return false; // safe default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool test() override
|
||||||
|
{
|
||||||
|
FbLocalStatus status;
|
||||||
|
|
||||||
|
att->ping(&status);
|
||||||
|
return !(status->getState() & IStatus::STATE_ERRORS);
|
||||||
|
}
|
||||||
|
|
||||||
// This 2 are needed to satisfy temporarily different calling requirements
|
// This 2 are needed to satisfy temporarily different calling requirements
|
||||||
static int shutdown(const int, const int, void*)
|
static int shutdown(const int, const int, void*)
|
||||||
{
|
{
|
||||||
|
@ -146,7 +146,12 @@ private:
|
|||||||
class SecurityDatabase : public VSecDb
|
class SecurityDatabase : public VSecDb
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool lookup(void* inMsg, void* outMsg);
|
bool lookup(void* inMsg, void* outMsg) override;
|
||||||
|
|
||||||
|
bool test() override
|
||||||
|
{
|
||||||
|
return fb_ping(status, &lookup_db) == FB_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// This 2 are needed to satisfy temporarily different calling requirements
|
// This 2 are needed to satisfy temporarily different calling requirements
|
||||||
static int shutdown(const int, const int, void*)
|
static int shutdown(const int, const int, void*)
|
||||||
|
@ -603,8 +603,6 @@ ExtEngineManager::ExternalContextImpl::ExternalContextImpl(thread_db* tdbb,
|
|||||||
|
|
||||||
clientCharSet = INTL_charset_lookup(tdbb, internalAttachment->att_client_charset)->getName();
|
clientCharSet = INTL_charset_lookup(tdbb, internalAttachment->att_client_charset)->getName();
|
||||||
|
|
||||||
internalAttachment->getStable()->addRef();
|
|
||||||
|
|
||||||
externalAttachment = MasterInterfacePtr()->registerAttachment
|
externalAttachment = MasterInterfacePtr()->registerAttachment
|
||||||
(internalAttachment->getProvider(), internalAttachment->getInterface());
|
(internalAttachment->getProvider(), internalAttachment->getInterface());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user