if (now - last_heartbeat >= me->heartbeat_interval) {
/* send heartbeats */
if (jcr->file_bsock) {
- bnet_sig(jcr->file_bsock, BNET_HEARTBEAT);
+ jcr->file_bsock->signal(BNET_HEARTBEAT);
Dmsg0(400, "Send heartbeat to FD.\n");
}
if (jcr->dir_bsock) {
- bnet_sig(jcr->dir_bsock, BNET_HEARTBEAT);
+ jcr->dir_bsock->signal(BNET_HEARTBEAT);
}
last_heartbeat = now;
}
if (stat == EINVAL) {
berrno be;
- Jmsg1(jcr, M_FATAL, 0, _("pthread timedwait error. ERR=%s\n"), be.strerror(stat));
+ Jmsg1(jcr, M_FATAL, 0, _("pthread timedwait error. ERR=%s\n"), be.bstrerror(stat));
stat = W_ERROR; /* error */
break;
}
* Returns: true if a device has changed state
* false if the total wait time has expired.
*/
-bool wait_for_device(JCR *jcr, bool first)
+bool wait_for_device(JCR *jcr, int &retries)
{
struct timeval tv;
struct timezone tz;
int stat = 0;
bool ok = true;
const int max_wait_time = 1 * 60; /* wait 1 minute */
+ char ed1[50];
Dmsg0(100, "Enter wait_for_device\n");
P(device_release_mutex);
- if (first) {
- Jmsg(jcr, M_MOUNT, 0, _("Job %s waiting to reserve a device.\n"), jcr->Job);
+ if (++retries % 5 == 0) {
+ /* Print message every 5 minutes */
+ Jmsg(jcr, M_MOUNT, 0, _("JobId=%s, Job %s waiting to reserve a device.\n"),
+ edit_uint64(jcr->JobId, ed1), jcr->Job);
}
gettimeofday(&tv, &tz);
stat = pthread_cond_timedwait(&wait_device_release, &device_release_mutex, &timeout);
Dmsg2(100, "JobId=%u wokeup from sleep on device stat=%d\n", (uint32_t)jcr->JobId, stat);
-
V(device_release_mutex);
Dmsg2(100, "JobId=%u return from wait_device ok=%d\n", (uint32_t)jcr->JobId, ok);
return ok;