/*
Bacula® - The Network Backup Solution
- Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
destroy();
}
+void BSOCK::free_tls()
+{
+ free_tls_connection(this->tls);
+ this->tls = NULL;
+}
+
/*
* Try to connect to host for max_retry_time at retry_time intervals.
* Note, you must have called the constructor prior to calling
/* Try to trap out of OS call when time expires */
if (max_retry_time) {
- tid = start_thread_timer(pthread_self(), (uint32_t)max_retry_time);
+ tid = start_thread_timer(jcr, pthread_self(), (uint32_t)max_retry_time);
}
for (i = 0; !open(jcr, name, host, service, port, heart_beat, &fatal);
/* send data packet */
timer_start = watchdog_time; /* start timer */
- m_timed_out = 0;
+ clear_timed_out();
/* Full I/O done in one write */
rc = write_nbytes(this, (char *)hdr, pktsiz);
timer_start = 0; /* clear timer */
read_seqno++; /* bump sequence number */
timer_start = watchdog_time; /* set start wait time */
- m_timed_out = 0;
+ clear_timed_out();
/* get data size -- in int32_t */
if ((nbytes = read_nbytes(this, (char *)&pktsiz, sizeof(int32_t))) <= 0) {
timer_start = 0; /* clear timer */
}
timer_start = watchdog_time; /* set start wait time */
- m_timed_out = 0;
+ clear_timed_out();
/* now read the actual data */
if ((nbytes = read_nbytes(this, msg, pktsiz)) <= 0) {
timer_start = 0; /* clear timer */
* Note, this routine closes and destroys all the sockets
* that are open including the duped ones.
*/
+#ifndef SHUT_RDWR
+#define SHUT_RDWR 2
+#endif
+
void BSOCK::close()
{
BSOCK *bsock = this;
bsock->tls = NULL;
}
if (bsock->is_timed_out()) {
- shutdown(bsock->m_fd, 2); /* discard any pending I/O */
+ shutdown(bsock->m_fd, SHUT_RDWR); /* discard any pending I/O */
}
socketClose(bsock->m_fd); /* normal close */
}