8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 15:23:03 +01:00

Fixed delivery of status vector from service thread

This commit is contained in:
alexpeshkoff 2009-12-17 12:32:32 +00:00
parent 0ce66da575
commit dceffbf006
11 changed files with 50 additions and 23 deletions

View File

@ -103,7 +103,10 @@ THREAD_ENTRY_DECLARE ALICE_main(THREAD_ENTRY_PARAM arg)
}
catch (const Firebird::Exception& e)
{
e.stuff_exception(uSvc->getStatus());
ISC_STATUS_ARRAY status;
e.stuff_exception(status);
uSvc->initStatus();
uSvc->setServiceStatus(status);
exit_code = FB_FAILURE;
}
@ -591,7 +594,8 @@ int alice(Firebird::UtilSvc* uSvc)
if ((exit_code != FINI_OK) && uSvc->isService())
{
memcpy(uSvc->getStatus(), tdgbl->status, sizeof (ISC_STATUS_ARRAY));
uSvc->initStatus();
uSvc->setServiceStatus(tdgbl->status);
}
return exit_code;

View File

@ -135,7 +135,10 @@ THREAD_ENTRY_DECLARE BURP_main(THREAD_ENTRY_PARAM arg)
}
catch (const Firebird::Exception& e)
{
e.stuff_exception(uSvc->getStatus());
ISC_STATUS_ARRAY status;
e.stuff_exception(status);
uSvc->initStatus();
uSvc->setServiceStatus(status);
exit_code = FB_FAILURE;
}
@ -1152,7 +1155,8 @@ int gbak(Firebird::UtilSvc* uSvc)
if ((exit_code != FINI_OK) && uSvc->isService())
{
memcpy(uSvc->getStatus(), tdgbl->status, sizeof (ISC_STATUS_ARRAY));
uSvc->initStatus();
uSvc->setServiceStatus(tdgbl->status);
}
return exit_code;

View File

@ -110,9 +110,10 @@ public:
virtual void putBytes(const UCHAR*, size_t) { }
virtual void setServiceStatus(const ISC_STATUS*) { }
virtual void setServiceStatus(const USHORT, const USHORT, const MsgFormat::SafeArg&) { }
virtual ISC_STATUS* getStatus() { return 0; }
virtual const ISC_STATUS* getStatus() { return 0; }
virtual void getAddressPath(ClumpletWriter&) { }
virtual bool finished() { return m_finished; };
virtual void initStatus() { }
private:
bool m_finished;

View File

@ -64,7 +64,8 @@ public:
virtual void setServiceStatus(const ISC_STATUS*) = 0;
virtual void setServiceStatus(const USHORT, const USHORT, const MsgFormat::SafeArg&) = 0;
virtual void hidePasswd(ArgvType&, int) = 0;
virtual ISC_STATUS* getStatus() = 0;
virtual const ISC_STATUS* getStatus() = 0;
virtual void initStatus() = 0;
virtual void checkService() = 0;
virtual void getAddressPath(Firebird::ClumpletWriter& dpb) = 0;
virtual bool finished() = 0;

View File

@ -3174,7 +3174,7 @@ ISC_STATUS GDS_SERVICE_QUERY(ISC_STATUS* user_status,
{
memcpy(user_status, service->getStatus(), sizeof(ISC_STATUS) * len);
// Empty out the service status vector
memset(service->getStatus(), 0, sizeof(ISC_STATUS_ARRAY));
service->initStatus();
return user_status[1];
}
}

View File

@ -605,11 +605,16 @@ void Service::hidePasswd(ArgvType&, int)
// no action
}
ISC_STATUS* Service::getStatus()
const ISC_STATUS* Service::getStatus()
{
return svc_status;
}
void Service::initStatus()
{
fb_utils::init_status(svc_status);
}
void Service::checkService()
{
// no action
@ -2213,7 +2218,7 @@ void Service::readFbLog()
}
catch (const Firebird::Exception& e)
{
e.stuff_exception(getStatus());
e.stuff_exception(svc_status);
}
if (file)

View File

@ -118,7 +118,9 @@ public: // utilities interface with service
// no-op for services
virtual void hidePasswd(ArgvType&, int);
// return service status
virtual ISC_STATUS* getStatus();
virtual const ISC_STATUS* getStatus();
// reset service status
virtual void initStatus();
// no-op for services
virtual void checkService();
// add address path (taken from spb) to dpb if present

View File

@ -342,7 +342,10 @@ THREAD_ENTRY_DECLARE TRACE_main(THREAD_ENTRY_PARAM arg)
}
catch (const Exception& e)
{
e.stuff_exception(svc->getStatus());
ISC_STATUS_ARRAY status;
e.stuff_exception(status);
svc->initStatus();
svc->setServiceStatus(status);
exit_code = FB_FAILURE;
}

View File

@ -100,7 +100,10 @@ THREAD_ENTRY_DECLARE GSEC_main(THREAD_ENTRY_PARAM arg)
}
catch (const Firebird::Exception& e)
{
e.stuff_exception(uSvc->getStatus());
ISC_STATUS_ARRAY status;
e.stuff_exception(status);
uSvc->initStatus();
uSvc->setServiceStatus(status);
exit_code = FB_FAILURE;
}
@ -381,11 +384,8 @@ int gsec(Firebird::UtilSvc* uSvc)
tdsec->tsec_throw = false;
GSEC_print_status(status);
if (uSvc->getStatus())
{
fb_utils::init_status(uSvc->getStatus());
uSvc->initStatus();
uSvc->setServiceStatus(status);
}
exit_code = FINI_ERROR;
}

View File

@ -267,7 +267,10 @@ THREAD_ENTRY_DECLARE main_gstat(THREAD_ENTRY_PARAM arg)
}
catch (const Firebird::Exception& e)
{
e.stuff_exception(uSvc->getStatus());
ISC_STATUS_ARRAY status;
e.stuff_exception(status);
uSvc->initStatus();
uSvc->setServiceStatus(status);
exit_code = FB_FAILURE;
}
@ -922,7 +925,8 @@ int gstat(Firebird::UtilSvc* uSvc)
if ((exit_code != FINI_OK) && uSvc->isService())
{
memcpy(uSvc->getStatus(), tddba->dba_status, sizeof (ISC_STATUS_ARRAY));
uSvc->initStatus();
uSvc->setServiceStatus(tddba->dba_status);
}
return exit_code;

View File

@ -1186,7 +1186,10 @@ THREAD_ENTRY_DECLARE NBACKUP_main(THREAD_ENTRY_PARAM arg)
}
catch (const Exception& e)
{
e.stuff_exception(uSvc->getStatus());
ISC_STATUS_ARRAY status;
e.stuff_exception(status);
uSvc->initStatus();
uSvc->setServiceStatus(status);
exit_code = FB_FAILURE;
}