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 207347 2010-04-28 22:39:47Z 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 /*
493 * First handshake step.
494 * Setup outgoing connection with remote node.
495 */
496 nvout = nv_alloc();
497 nv_add_string(nvout, res->hr_name, "resource");
498 if (nv_error(nvout) != 0) {
499 pjdlog_common(LOG_WARNING, 0, nv_error(nvout),
--- 47 unchanged lines hidden (view full) ---
547 res->hr_remoteaddr);
548 }
549 /* Try to connect, but accept failure. */
550 if (proto_connect(in) < 0) {
551 pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
552 res->hr_remoteaddr);
553 goto close;
554 }
555 nvout = nv_alloc();
556 nv_add_string(nvout, res->hr_name, "resource");
557 nv_add_uint8_array(nvout, res->hr_token, sizeof(res->hr_token),
558 "token");
559 nv_add_uint64(nvout, res->hr_resuid, "resuid");
560 nv_add_uint64(nvout, res->hr_primary_localcnt, "localcnt");
561 nv_add_uint64(nvout, res->hr_primary_remotecnt, "remotecnt");
562 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 207347 2010-04-28 22:39:47Z 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 /*
493 * First handshake step.
494 * Setup outgoing connection with remote node.
495 */
496 nvout = nv_alloc();
497 nv_add_string(nvout, res->hr_name, "resource");
498 if (nv_error(nvout) != 0) {
499 pjdlog_common(LOG_WARNING, 0, nv_error(nvout),
--- 47 unchanged lines hidden (view full) ---
547 res->hr_remoteaddr);
548 }
549 /* Try to connect, but accept failure. */
550 if (proto_connect(in) < 0) {
551 pjdlog_errno(LOG_WARNING, "Unable to connect to %s",
552 res->hr_remoteaddr);
553 goto close;
554 }
555 nvout = nv_alloc();
556 nv_add_string(nvout, res->hr_name, "resource");
557 nv_add_uint8_array(nvout, res->hr_token, sizeof(res->hr_token),
558 "token");
559 nv_add_uint64(nvout, res->hr_resuid, "resuid");
560 nv_add_uint64(nvout, res->hr_primary_localcnt, "localcnt");
561 nv_add_uint64(nvout, res->hr_primary_remotecnt, "remotecnt");
562 if (nv_error(nvout) != 0) {
--- 1231 unchanged lines hidden ---