Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/jrd/svc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ void Service::putBytes(const UCHAR* bytes, FB_SIZE_T len)

void Service::setServiceStatus(const ISC_STATUS* status_vector)
{
if (checkForShutdown())
if (checkForShutdown() || checkForFailedStart())
{
return;
}
Expand All @@ -529,7 +529,7 @@ void Service::setServiceStatus(const ISC_STATUS* status_vector)
void Service::setServiceStatus(const USHORT facility, const USHORT errcode,
const MsgFormat::SafeArg& args)
{
if (checkForShutdown())
if (checkForShutdown() || checkForFailedStart())
{
return;
}
Expand Down Expand Up @@ -974,6 +974,22 @@ bool Service::checkForShutdown()
}


bool Service::checkForFailedStart()
{
if ((svc_flags & SVC_evnt_fired) == 0)
{
// Service has not been started but we have got an error
svc_flags |= SVC_failed_start;
}
else if ((svc_flags & SVC_failed_start) != 0)
{
// Service has started with an error but we are trying to write one more error
return true;
}

return false;
}

void Service::cancel(thread_db* /*tdbb*/)
{
svc_shutdown_request = true;
Expand Down
3 changes: 3 additions & 0 deletions src/jrd/svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const int SVC_finished = 0x10;
//const int SVC_thd_running = 0x20;
const int SVC_evnt_fired = 0x40;
const int SVC_cmd_line = 0x80;
const int SVC_failed_start = 0x100;

// forward decl.
class thread_db;
Expand Down Expand Up @@ -245,6 +246,8 @@ class Service : public Firebird::UtilSvc, public TypedHandle<type_svc>
void finish(USHORT flag);
// Throws shutdown exception if global flag is set for it
bool checkForShutdown();
// Check for the existence of errors in the service that has not started
bool checkForFailedStart();
// Transfer data from svc_stdout into buffer
void get(UCHAR* buffer, USHORT length, USHORT flags, USHORT timeout, USHORT* return_length);
// Sends stdin for a service
Expand Down
Loading