Lines Matching refs:adhost
82 static struct adist_host *adhost; variable
142 if (proto_send(adhost->adh_conn, &val, sizeof(val)) < 0) { in sender_connect()
146 if (proto_recv(adhost->adh_conn, &val, sizeof(val)) < 0) { in sender_connect()
153 adhost->adh_remoteaddr); in sender_connect()
156 if (proto_connection_recv(adhost->adh_conn, true, &conn) < 0) { in sender_connect()
162 adhost->adh_remoteaddr); in sender_connect()
166 pjdlog_debug(1, "Connected to %s.", adhost->adh_remoteaddr); in sender_connect()
178 adhost->adh_remoteaddr); in sender_connect()
187 adhost->adh_remoteaddr); in sender_connect()
194 adhost->adh_remoteaddr); in sender_connect()
203 adhost->adh_version = atoi(welcome + 5); in sender_connect()
204 if (adhost->adh_version > ADIST_VERSION) { in sender_connect()
206 adhost->adh_remoteaddr, adhost->adh_version, ADIST_VERSION); in sender_connect()
211 pjdlog_debug(1, "Version %d negotiated with %s.", adhost->adh_version, in sender_connect()
212 adhost->adh_remoteaddr); in sender_connect()
216 adhost->adh_remoteaddr); in sender_connect()
224 adhost->adh_remoteaddr); in sender_connect()
230 if (HMAC(EVP_sha256(), adhost->adh_password, in sender_connect()
231 (int)strlen(adhost->adh_password), rnd, (int)sizeof(rnd), hash, in sender_connect()
241 adhost->adh_remoteaddr); in sender_connect()
256 adhost->adh_remoteaddr); in sender_connect()
264 adhost->adh_remoteaddr); in sender_connect()
270 if (HMAC(EVP_sha256(), adhost->adh_password, in sender_connect()
271 (int)strlen(adhost->adh_password), rnd, (int)sizeof(rnd), hash, in sender_connect()
281 adhost->adh_remoteaddr); in sender_connect()
287 if (proto_recv(conn, &adhost->adh_trail_offset, in sender_connect()
288 sizeof(adhost->adh_trail_offset)) == -1) { in sender_connect()
291 adhost->adh_remoteaddr); in sender_connect()
295 adhost->adh_trail_offset = le64toh(adhost->adh_trail_offset); in sender_connect()
296 if (proto_recv(conn, &adhost->adh_trail_name, in sender_connect()
297 sizeof(adhost->adh_trail_name)) == -1) { in sender_connect()
300 adhost->adh_remoteaddr); in sender_connect()
305 adhost->adh_trail_name, (uintmax_t)adhost->adh_trail_offset); in sender_connect()
309 PJDLOG_ASSERT(adhost->adh_remote == NULL); in sender_connect()
311 adhost->adh_remote = conn; in sender_connect()
328 if (adhost->adh_remote == NULL) { in sender_disconnect()
332 pjdlog_debug(2, "Closing connection to %s.", adhost->adh_remoteaddr); in sender_disconnect()
333 proto_close(adhost->adh_remote); in sender_disconnect()
335 adhost->adh_remote = NULL; in sender_disconnect()
336 adhost->adh_reset = true; in sender_disconnect()
337 adhost->adh_trail_name[0] = '\0'; in sender_disconnect()
338 adhost->adh_trail_offset = 0; in sender_disconnect()
342 pjdlog_warning("Disconnected from %s.", adhost->adh_remoteaddr); in sender_disconnect()
387 if (adhost->adh_reset) { in read_thread_wait()
389 adhost->adh_reset = false; in read_thread_wait()
393 while (adhost->adh_remote == NULL) in read_thread_wait()
395 trail_start(adist_trail, adhost->adh_trail_name, in read_thread_wait()
396 adhost->adh_trail_offset); in read_thread_wait()
408 if (adhost->adh_reset) in read_thread_wait()
416 adhost->adh_directory, in read_thread_wait()
453 adhost->adh_directory, trail_filename(adist_trail), in read_thread()
461 adhost->adh_directory, trail_filename(adist_trail)); in read_thread()
494 if (adhost->adh_remote == NULL) { in keepalive_send()
550 if (adhost->adh_remote == NULL || in send_thread()
551 proto_send(adhost->adh_remote, &adreq->adr_packet, in send_thread()
556 if (adhost->adh_remote != NULL) in send_thread()
595 if (adhost->adh_remote == NULL) { in recv_thread()
607 if (proto_recv(adhost->adh_remote, &adrep, in recv_thread()
667 PJDLOG_ASSERT(adhost->adh_role == ADIST_ROLE_SENDER); in guard_check_connection()
670 if (adhost->adh_remote != NULL) { in guard_check_connection()
673 adhost->adh_remoteaddr); in guard_check_connection()
683 adhost->adh_remoteaddr); in guard_check_connection()
686 adhost->adh_remoteaddr); in guard_check_connection()
689 adhost->adh_remoteaddr); in guard_check_connection()
773 adhost = adh; in adist_sender()
779 proto_send(adhost->adh_conn, NULL, 0); in adist_sender()
781 descriptors_cleanup(adhost); in adist_sender()
784 descriptors_assert(adhost, mode); in adist_sender()
789 pjdlog_prefix_set("[%s] (%s) ", adhost->adh_name, in adist_sender()
790 role2str(adhost->adh_role)); in adist_sender()
792 setproctitle("[%s] (%s) ", adhost->adh_name, in adist_sender()
793 role2str(adhost->adh_role)); in adist_sender()
801 adist_trail = trail_new(adhost->adh_directory, false); in adist_sender()
806 role2str(adhost->adh_role), adhost->adh_name) != 0) { in adist_sender()
820 adhost->adh_remoteaddr); in adist_sender()
822 adhost->adh_reset = true; in adist_sender()