pthread_detach(pthread_self());
- /* ****FIXME**** put # 5 on config parameter */
- bnet_thread_server(UA->addr, UA->port, 5, &ua_workq, handle_UA_client_request);
+ /* ****FIXME**** put # 10 on config parameter */
+ bnet_thread_server(UA->addr, UA->port, 10, &ua_workq, handle_UA_client_request);
return NULL;
}
/*
- * Create a Job Control Record for a console "job"
+ * Create a Job Control Record for a control "job",
* filling in all the appropriate fields.
*/
-static JCR *create_console_jcr()
+JCR *new_control_jcr(char *base_name, int job_type)
{
JCR *jcr;
jcr = new_jcr(sizeof(JCR), dird_free_jcr);
jcr->sd_auth_key = bstrdup("dummy"); /* dummy Storage daemon key */
- create_unique_job_name(jcr, "*Console*");
+ create_unique_job_name(jcr, base_name);
jcr->sched_time = jcr->start_time;
- jcr->JobType = JT_CONSOLE;
- jcr->JobLevel = L_FULL;
+ jcr->JobType = job_type;
+ jcr->JobLevel = L_NONE;
jcr->JobStatus = JS_Running;
- /* None of these are really defined for the Console, so we
+ jcr->JobId = 0;
+ /*
+ * None of these are really defined for control JCRs, so we
* simply take the first of each one. This ensures that there
* will be no null pointer references.
*/
pthread_detach(pthread_self());
- jcr = create_console_jcr();
+ jcr = new_control_jcr("*Console*", JT_CONSOLE);
ua = new_ua_context(jcr);
ua->UA_sock = UA_sock;
bnet_recv(ua->UA_sock); /* Get first message */
- if (!authenticate_user_agent(ua->UA_sock)) {
+ if (!authenticate_user_agent(ua)) {
goto getout;
}
while (!ua->quit) {
stat = bnet_recv(ua->UA_sock);
if (stat >= 0) {
- ua->cmd = check_pool_memory_size(ua->cmd, ua->UA_sock->msglen+1);
- bstrncpy(ua->cmd, ua->UA_sock->msg, ua->UA_sock->msglen+1);
+ pm_strcpy(&ua->cmd, ua->UA_sock->msg);
parse_ua_args(ua);
if (ua->argc > 0 && ua->argk[0][0] == '.') {
do_a_dot_command(ua, ua->cmd);
getout:
- close_db(ua); /* do this before freeing JCR */
+ close_db(ua);
free_ua_context(ua);
free_jcr(jcr);
if (ua->UA_sock) {
bnet_close(ua->UA_sock);
}
-
free(ua);
}