- /*
- * Wait requested time (dev->rem_wait_sec). However, we also wake up every
- * HB_TIME seconds and send a heartbeat to the FD and the Director
- * to keep stateful firewalls from closing them down while waiting
- * for the operator.
- */
- add_wait = jcr->rem_wait_sec;
- if (me->heartbeat_interval && add_wait > me->heartbeat_interval) {
- add_wait = me->heartbeat_interval;
- }
-
- for ( ; !job_canceled(jcr); ) {
- time_t now, start;
-
- gettimeofday(&tv, &tz);
- timeout.tv_nsec = tv.tv_usec * 1000;
- timeout.tv_sec = tv.tv_sec + add_wait;
-
- Dmsg3(100, "I'm going to wait for a device. HB=%d wait=%d remwait=%d\n",
- (int)me->heartbeat_interval, jcr->wait_sec, jcr->rem_wait_sec);
- start = time(NULL);
- /* Wait required time */
- stat = pthread_cond_timedwait(&wait_device_release, &device_release_mutex, &timeout);
- Dmsg1(100, "Wokeup from sleep on device stat=%d\n", stat);
+ gettimeofday(&tv, &tz);
+ timeout.tv_nsec = tv.tv_usec * 1000;
+ timeout.tv_sec = tv.tv_sec + wait_time;