Skip to content

Commit

Permalink
dird: show current and allowed console connections
Browse files Browse the repository at this point in the history
When the allowed number of console connectinos was exceeded, before
only the fact that it is exceeded was logged without numbers.

Now both the allowed maximum and the current value are printed.
  • Loading branch information
pstorz authored and sebsura committed Aug 4, 2023
1 parent 136248f commit 5b00b44
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions core/src/dird/authenticate_console.cc
Expand Up @@ -354,17 +354,16 @@ static void LogErrorMessage(std::string console_name, UaContext* ua)
ua->UA_sock->port());
}

static bool NumberOfConsoleConnectionsExceeded()
static uint32_t CurrentNumberOfConsoleConnections()
{
JobControlRecord* jcr;
unsigned int cnt = 0;
uint32_t cnt = 0;

foreach_jcr (jcr) {
if (jcr->is_JobType(JT_CONSOLE)) { cnt++; }
}
endeach_jcr(jcr);

return (cnt >= me->MaxConsoleConnections) ? true : false;
return cnt;
}

static bool GetConsoleNameAndVersion(BareosSocket* ua_sock,
Expand Down Expand Up @@ -407,10 +406,12 @@ static ConsoleAuthenticator* CreateConsoleAuthenticator(UaContext* ua)

bool AuthenticateConsole(UaContext* ua)
{
if (NumberOfConsoleConnectionsExceeded()) {
uint32_t ConsoleConnections = CurrentNumberOfConsoleConnections();
if (ConsoleConnections >= me->MaxConsoleConnections) {
Emsg0(M_ERROR, 0,
_("Number of console connections exceeded "
"MaximumConsoleConnections\n"));
"Maximum :%u, Current: %u\n"),
me->MaxConsoleConnections, ConsoleConnections);
return false;
}

Expand Down

0 comments on commit 5b00b44

Please sign in to comment.