int Slot, int relabel);
struct s_cmds {
- char *cmd;
+ const char *cmd;
int (*func)(JCR *jcr);
};
* - We execute the command
* - We continue or exit depending on the return status
*/
-void *connection_request(void *arg)
+void *handle_connection_request(void *arg)
{
BSOCK *bs = (BSOCK *)arg;
JCR *jcr;
if (bnet_recv(bs) <= 0) {
Emsg0(M_ERROR, 0, _("Connection request failed.\n"));
+ bnet_close(bs);
return NULL;
}
*/
if (bs->msglen < 25 || bs->msglen > (int)sizeof(name)-25) {
Emsg1(M_ERROR, 0, _("Invalid Dir connection. Len=%d\n"), bs->msglen);
+ bnet_close(bs);
+ return NULL;
}
/*
* See if this is a File daemon connection. If so
* call FD handler.
*/
- if (sscanf(bs->msg, "Hello Start Job %127s calling\n", name) == 1) {
+ Dmsg1(110, "Conn: %s", bs->msg);
+ if (sscanf(bs->msg, "Hello Start Job %127s", name) == 1) {
handle_filed_connection(bs, name);
return NULL;
}
+ Dmsg0(110, "Start Dir Job\n");
jcr = new_jcr(sizeof(JCR), stored_free_jcr); /* create Job Control Record */
jcr->dir_bsock = bs; /* save Director bsock */
jcr->dir_bsock->jcr = jcr;
+ /* Initialize FD start condition variable */
+ int errstat = pthread_cond_init(&jcr->job_start_wait, NULL);
+ if (errstat != 0) {
+ Jmsg1(jcr, M_FATAL, 0, _("Unable to init job cond variable: ERR=%s\n"), strerror(errstat));
+ free_jcr(jcr);
+ return NULL;
+ }
Dmsg0(1000, "stored in start_job\n");
/* Fall through wanted! */
case VOL_IO_ERROR:
case VOL_NO_LABEL:
- if (!write_volume_label_to_dev(jcr, jcr->device, newname, poolname)) {
+ if (!write_new_volume_label_to_dev(jcr, jcr->device, newname, poolname)) {
bnet_fsend(dir, _("3912 Failed to label Volume: ERR=%s\n"), strerror_dev(dev));
break;
}