/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2017 Kern Sibbald
+ Copyright (C) 2000-2018 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
/* Imported subroutines */
JCR *wait_for_next_job(char *runjob);
void term_scheduler();
-void term_ua_server();
void start_UA_server(dlist *addrs);
+void stop_UA_server();
void init_job_server(int max_workers);
void term_job_server();
void store_jobtype(LEX *lc, RES_ITEM *item, int index, int pass);
delete config;
config = NULL;
}
- term_ua_server();
+ stop_UA_server();
term_msg(); /* terminate message handler */
cleanup_crypto();
/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2015 Kern Sibbald
+ Copyright (C) 2000-2018 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
/* Global variables */
-static int started = FALSE;
+static bool started = false;
+static pthread_t server_tid;
+static bool server_tid_valid = false;
static workq_t ua_workq;
struct s_addr_port {
berrno be;
Emsg1(M_ABORT, 0, _("Cannot create UA thread: %s\n"), be.bstrerror(status));
}
- started = TRUE;
+ started = true;
return;
}
+void stop_UA_server()
+{
+ if (started && server_tid_valid) {
+ server_tid_valid = false;
+ bnet_stop_thread_server(server_tid);
+ }
+}
+
extern "C"
void *connect_thread(void *arg)
{
pthread_detach(pthread_self());
set_jcr_in_tsd(INVALID_JCR);
+ server_tid = pthread_self();
+ server_tid_valid = true;
+
/* Permit MaxConsoleConnect console connections */
bnet_thread_server((dlist*)arg, director->MaxConsoleConnect, &ua_workq, handle_UA_client_request);
return NULL;
free_bsock(ua->UA_sock);
free(ua);
}
-
-
-/*
- * Called from main Bacula thread
- */
-void term_ua_server()
-{
- if (!started) {
- return;
- }
-}
/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2017 Kern Sibbald
+ Copyright (C) 2000-2018 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
return 0;
}
-/* [B
+/*
* Destroy a work queue
*
* Returns: 0 on success
/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2017 Kern Sibbald
+ Copyright (C) 2000-2018 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
}
}
if (server_tid_valid) {
+ server_tid_valid = false;
bnet_stop_thread_server(server_tid);
}