globals = (CLIENT_GLOBALS *)malloc(sizeof(CLIENT_GLOBALS));
memset(globals, 0, sizeof(CLIENT_GLOBALS));
globals->name = bstrdup(name());
+ globals->enabled = -1; /* Not set */
client_globals.append(globals);
}
P(globals_mutex);
if (!globals) {
create_client_globals();
- /* Copy .conf IP address and Enabled */
- globals->enabled = Enabled;
- globals->SetIPaddress = bstrdup(client_address);
}
globals->NumConcurrentJobs = num;
V(globals_mutex);
if (!globals->SetIPaddress) {
return client_address;
}
+ /* TODO: Fix concurrency issue between setAddress() and address()
+ * we need to copy the address in an argument, the variable can be
+ * freed at any time.
+ */
return globals->SetIPaddress;
}
P(globals_mutex);
if (!globals) {
create_client_globals();
- globals->enabled = Enabled; /* copy .conf variable */
}
if (globals->SetIPaddress) {
free(globals->SetIPaddress);
bool CLIENT::is_enabled()
{
- if (!globals) {
+ if (!globals || globals->enabled < 0) {
return Enabled;
}
return globals->enabled;
P(globals_mutex);
if (!globals) {
create_client_globals();
- globals->SetIPaddress = bstrdup(client_address); /* copy .conf variable */
}
- globals->enabled = val;
+ /* TODO: We probably need to set -1 (not set) when we are back to the default value */
+ globals->enabled = val? 1 : 0;
V(globals_mutex);
Dmsg2(200, "Set Enabled=%d for Client %s\n",
val, globals->name);
globals = (JOB_GLOBALS *)malloc(sizeof(JOB_GLOBALS));
memset(globals, 0, sizeof(JOB_GLOBALS));
globals->name = bstrdup(name());
+ globals->enabled = -1; /* Not set */
job_globals.append(globals);
}
P(globals_mutex);
if (!globals) {
create_job_globals();
- globals->enabled = Enabled; /* copy .conf variable */
}
globals->NumConcurrentJobs = num;
V(globals_mutex);
bool JOB::is_enabled()
{
- if (!globals) {
+ if (!globals || globals->enabled < 0) {
return Enabled;
}
return globals->enabled;
if (!globals) {
create_job_globals();
}
- globals->enabled = val;
+ globals->enabled = val ? 1 : 0;
V(globals_mutex);
Dmsg2(200, "Set Enabled=%d for Job %s\n",
val, globals->name);
globals = (STORE_GLOBALS *)malloc(sizeof(STORE_GLOBALS));
memset(globals, 0, sizeof(STORE_GLOBALS));
globals->name = bstrdup(name());
+ globals->enabled = -1; /* Not set */
store_globals.append(globals);
}
P(globals_mutex);
if (!globals) {
create_store_globals();
- globals->enabled = Enabled; /* copy .conf variable */
}
globals->NumConcurrentReadJobs = num;
V(globals_mutex);
P(globals_mutex);
if (!globals) {
create_store_globals();
- globals->enabled = Enabled; /* copy .conf variable */
}
globals->NumConcurrentJobs = num;
V(globals_mutex);
bool STORE::is_enabled()
{
- if (!globals) {
+ if (!globals || globals->enabled < 0) {
return Enabled;
}
return globals->enabled;
if (!globals) {
create_store_globals();
}
- globals->enabled = val;
+ globals->enabled = val ? 1 : 0;
V(globals_mutex);
Dmsg2(200, "Set Enabled=%d for Storage %s\n",
val, globals->name);
globals = (SCHED_GLOBALS *)malloc(sizeof(CLIENT_GLOBALS));
memset(globals, 0, sizeof(SCHED_GLOBALS));
globals->name = bstrdup(name());
+ globals->enabled = -1; /* Not set */
sched_globals.append(globals);
}
bool SCHED::is_enabled()
{
- if (!globals) {
+ if (!globals || globals->enabled < 0) {
return Enabled;
}
return globals->enabled;
if (!globals) {
create_sched_globals();
}
- globals->enabled = val;
+ globals->enabled = val ? 1 : 0;
V(globals_mutex);
Dmsg2(200, "Set Enabled=%d for Schedule %s\n",
val, globals->name);
const char *name; /* resource name */
int32_t NumConcurrentJobs; /* number of concurrent jobs running */
char *SetIPaddress; /* address from SetIP command */
- bool enabled; /* Enabled/disabled */
+ int enabled; /* -1: not set, 0 disabled, 1 enabled */
};
/*
const char *name; /* resource name */
int32_t NumConcurrentJobs; /* number of concurrent jobs running */
int32_t NumConcurrentReadJobs; /* number of concurrent read jobs running */
- bool enabled; /* Enabled/disabled */
+ int enabled; /* -1: not set, 0: disabled, 1: enabled */
};
dlink link; /* double link */
const char *name; /* resource name */
int32_t NumConcurrentJobs; /* number of concurrent jobs running */
- bool enabled; /* Enabled/disabled */
+ int enabled; /* -1: disabled, 0: disabled, 1: Enabled */
};
/*
public:
dlink link; /* double link */
const char *name; /* resource name */
- bool enabled; /* Enabled/disabled */
+ int enabled; /* -1: not set, 0: disabled, 1: Enabled */
};
/*