1/*-
2 * Copyright (c) 2009 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Pawel Jakub Dawidek under sponsorship from
6 * the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 14 unchanged lines hidden (view full) ---
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sbin/hastd/primary.c 207371 2010-04-29 15:36:32Z pjd $");
32
33#include <sys/types.h>
34#include <sys/time.h>
35#include <sys/bio.h>
36#include <sys/disk.h>
37#include <sys/refcount.h>
38#include <sys/stat.h>
39
--- 444 unchanged lines hidden (view full) ---
484 res->hr_remoteaddr);
485 }
486 /* Try to connect, but accept failure. */
487 if (proto_connect(out) < 0) {
488 pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
489 res->hr_remoteaddr);
490 goto close;
491 }
492 /* Error in setting timeout is not critical, but why should it fail? */
493 if (proto_timeout(out, res->hr_timeout) < 0)
494 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout");
495 /*
496 * First handshake step.
497 * Setup outgoing connection with remote node.
498 */
499 nvout = nv_alloc();
500 nv_add_string(nvout, res->hr_name, "resource");
501 if (nv_error(nvout) != 0) {
502 pjdlog_common(LOG_WARNING, 0, nv_error(nvout),
--- 47 unchanged lines hidden (view full) ---
550 res->hr_remoteaddr);
551 }
552 /* Try to connect, but accept failure. */
553 if (proto_connect(in) < 0) {
554 pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
555 res->hr_remoteaddr);
556 goto close;
557 }
558 /* Error in setting timeout is not critical, but why should it fail? */
559 if (proto_timeout(in, res->hr_timeout) < 0)
560 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout");
561 nvout = nv_alloc();
562 nv_add_string(nvout, res->hr_name, "resource");
563 nv_add_uint8_array(nvout, res->hr_token, sizeof(res->hr_token),
564 "token");
565 nv_add_uint64(nvout, res->hr_resuid, "resuid");
566 nv_add_uint64(nvout, res->hr_primary_localcnt, "localcnt");
567 nv_add_uint64(nvout, res->hr_primary_remotecnt, "remotecnt");
568 if (nv_error(nvout) != 0) {
--- 1231 unchanged lines hidden ---
2 * Copyright (c) 2009 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Pawel Jakub Dawidek under sponsorship from
6 * the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 14 unchanged lines hidden (view full) ---
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sbin/hastd/primary.c 207371 2010-04-29 15:36:32Z pjd $");
32
33#include <sys/types.h>
34#include <sys/time.h>
35#include <sys/bio.h>
36#include <sys/disk.h>
37#include <sys/refcount.h>
38#include <sys/stat.h>
39
--- 444 unchanged lines hidden (view full) ---
484 res->hr_remoteaddr);
485 }
486 /* Try to connect, but accept failure. */
487 if (proto_connect(out) < 0) {
488 pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
489 res->hr_remoteaddr);
490 goto close;
491 }
492 /* Error in setting timeout is not critical, but why should it fail? */
493 if (proto_timeout(out, res->hr_timeout) < 0)
494 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout");
495 /*
496 * First handshake step.
497 * Setup outgoing connection with remote node.
498 */
499 nvout = nv_alloc();
500 nv_add_string(nvout, res->hr_name, "resource");
501 if (nv_error(nvout) != 0) {
502 pjdlog_common(LOG_WARNING, 0, nv_error(nvout),
--- 47 unchanged lines hidden (view full) ---
550 res->hr_remoteaddr);
551 }
552 /* Try to connect, but accept failure. */
553 if (proto_connect(in) < 0) {
554 pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
555 res->hr_remoteaddr);
556 goto close;
557 }
558 /* Error in setting timeout is not critical, but why should it fail? */
559 if (proto_timeout(in, res->hr_timeout) < 0)
560 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout");
561 nvout = nv_alloc();
562 nv_add_string(nvout, res->hr_name, "resource");
563 nv_add_uint8_array(nvout, res->hr_token, sizeof(res->hr_token),
564 "token");
565 nv_add_uint64(nvout, res->hr_resuid, "resuid");
566 nv_add_uint64(nvout, res->hr_primary_localcnt, "localcnt");
567 nv_add_uint64(nvout, res->hr_primary_remotecnt, "remotecnt");
568 if (nv_error(nvout) != 0) {
--- 1231 unchanged lines hidden ---