if (bs->recv() <= 0) {
Emsg0(M_ERROR, 0, _("Connection request failed.\n"));
- bnet_close(bs);
+ bs->close();
return NULL;
}
/*
* Do a sanity check on the message received
*/
- if (bs->msglen < 25 || bs->msglen > (int)sizeof(name)-25) {
+ if (bs->msglen < 25 || bs->msglen > (int)sizeof(name)+100) {
+ Dmsg1(000, "<filed: %s", bs->msg);
Emsg1(M_ERROR, 0, _("Invalid connection. Len=%d\n"), bs->msglen);
- bnet_close(bs);
+ bs->close();
return NULL;
}
/*
* call FD handler.
*/
Dmsg1(110, "Conn: %s", bs->msg);
+ if (debug_level == 3) {
+ Dmsg1(000, "<filed: %s", bs->msg);
+ }
if (sscanf(bs->msg, "Hello Start Job %127s", name) == 1) {
Dmsg0(110, "Got a FD connection\n");
handle_filed_connection(bs, name);
if (strncmp(cmds[i].cmd, bs->msg, strlen(cmds[i].cmd)) == 0) {
if ((!cmds[i].monitoraccess) && (jcr->director->monitor)) {
Dmsg1(100, "Command \"%s\" is invalid.\n", cmds[i].cmd);
- bnet_fsend(bs, invalid_cmd);
+ bs->fsend(invalid_cmd);
bs->signal(BNET_EOD);
break;
}
}
}
if (!found) { /* command not found */
- bnet_fsend(bs, derrmsg);
+ bs->fsend(derrmsg);
break;
}
}
bail_out:
generate_daemon_event(jcr, "JobEnd");
dequeue_messages(jcr); /* send any queued messages */
- bnet_sig(bs, BNET_TERMINATE);
+ bs->signal(BNET_TERMINATE);
free_jcr(jcr);
return NULL;
}
}
/*
- * After receiving a connection (in job.c) if it is
+ * After receiving a connection (in dircmd.c) if it is
* from the File daemon, this routine is called.
*/
void handle_filed_connection(BSOCK *fd, char *job_name)
bmicrosleep(0, 50000); /* wait 50 millisecs */
if (!(jcr=get_jcr_by_full_name(job_name))) {
- Jmsg1(NULL, M_FATAL, 0, _("Job name not found: %s\n"), job_name);
+ Jmsg1(NULL, M_FATAL, 0, _("FD connect failed: Job name not found: %s\n"), job_name);
Dmsg1(100, "Job name not found: %s\n", job_name);
return;
}
if (jcr->authenticated) {
Jmsg2(jcr, M_FATAL, 0, _("Hey!!!! JobId %u Job %s already authenticated.\n"),
- jcr->JobId, jcr->Job);
+ (uint32_t)jcr->JobId, jcr->Job);
free_jcr(jcr);
return;
}
/*
* Authenticate the File daemon
*/
+ if (debug_level == 3) {
+ Dmsg1(000, "sd_auth_key=%s\n", jcr->sd_auth_key);
+ }
if (jcr->authenticated || !authenticate_filed(jcr)) {
Dmsg1(100, "Authentication failed Job %s\n", jcr->Job);
Jmsg(jcr, M_FATAL, 0, _("Unable to authenticate File daemon\n"));