- jcr->hb_dir_bsock->timed_out = 1; /* set timed_out to terminate read */
- jcr->hb_dir_bsock->terminated = 1; /* set to terminate read */
+ jcr->hb_dir_bsock->set_timed_out(); /* set timed_out to terminate read */
+ jcr->hb_dir_bsock->set_terminated(); /* set to terminate read */
+ }
+ if (jcr->hb_started) {
+ Dmsg0(100, "Send kill to heartbeat id\n");
+ pthread_kill(jcr->heartbeat_id, TIMEOUT_SIGNAL); /* make heartbeat thread go away */
+ bmicrosleep(0, 50000);