Author: pjd
Date: Sat Apr  2 09:25:13 2011
New Revision: 220271
URL: http://svn.freebsd.org/changeset/base/220271

Log:
  Declare directions for sockets between primary and secondary.
  In HAST we use two sockets - one for only sending the data and one for only
  receiving the data.
  
  MFC after:    1 month

Modified:
  head/sbin/hastd/primary.c
  head/sbin/hastd/secondary.c

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c   Sat Apr  2 09:22:06 2011        (r220270)
+++ head/sbin/hastd/primary.c   Sat Apr  2 09:25:13 2011        (r220271)
@@ -701,6 +701,11 @@ init_remote(struct hast_resource *res, s
                (void)hast_activemap_flush(res);
        }
        nv_free(nvin);
+       /* Setup directions. */
+       if (proto_send(out, NULL, 0) == -1)
+               pjdlog_errno(LOG_WARNING, "Unable to set connection direction");
+       if (proto_recv(in, NULL, 0) == -1)
+               pjdlog_errno(LOG_WARNING, "Unable to set connection direction");
        pjdlog_info("Connected to %s.", res->hr_remoteaddr);
        if (inp != NULL && outp != NULL) {
                *inp = in;

Modified: head/sbin/hastd/secondary.c
==============================================================================
--- head/sbin/hastd/secondary.c Sat Apr  2 09:22:06 2011        (r220270)
+++ head/sbin/hastd/secondary.c Sat Apr  2 09:25:13 2011        (r220271)
@@ -183,6 +183,10 @@ init_remote(struct hast_resource *res, s
        unsigned char *map;
        size_t mapsize;
 
+       /* Setup direction. */
+       if (proto_send(res->hr_remoteout, NULL, 0) == -1)
+               pjdlog_errno(LOG_WARNING, "Unable to set connection direction");
+
        map = NULL;
        mapsize = 0;
        nvout = nv_alloc();
@@ -346,6 +350,9 @@ init_remote(struct hast_resource *res, s
        if (map != NULL)
                free(map);
        nv_free(nvout);
+       /* Setup direction. */
+       if (proto_recv(res->hr_remotein, NULL, 0) == -1)
+               pjdlog_errno(LOG_WARNING, "Unable to set connection direction");
        if (res->hr_secondary_localcnt > res->hr_primary_remotecnt &&
             res->hr_primary_localcnt > res->hr_secondary_remotecnt) {
                /* Exit on split-brain. */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to