Mop up small problems from the name/host split. In one place we
printed "slave (null)". In other place printing name made more sense.

Most importantly, while CLD client used name correctly, we sent a slave
login using host (argument to rtdb_start), which was incorrect.
Swap that to replication name.

Signed-off-by: Pete Zaitcev <zait...@redhat.com>

---
 server/metarep.c |    2 +-
 server/server.c  |   10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

commit 294393ed1a0789b71b673f894232ba1b5cdb9dc3
Author: Pete Zaitcev <zait...@yahoo.com>
Date:   Thu Aug 12 12:30:45 2010 -0600

    Cleanup of name vs host.

diff --git a/server/metarep.c b/server/metarep.c
index e13b13f..9466029 100644
--- a/server/metarep.c
+++ b/server/metarep.c
@@ -884,7 +884,7 @@ static int rtdb_master_login_reply(struct db_conn *dbc, 
unsigned char *msgbuf)
        }
        if (debugging)
                applog(LOG_DEBUG, "Link login, slave %s dbid %d",
-                      slave->host, slave->dbid);
+                      slave->name, slave->dbid);
 
        /*
         * Dispose of all existing connections. Our current implementation
diff --git a/server/server.c b/server/server.c
index 1f8164b..829d2db 100644
--- a/server/server.c
+++ b/server/server.c
@@ -399,7 +399,7 @@ static void stats_dump(void)
 
        applog(LOG_INFO, "TDB: group %s state %s host %s rep_port %d dbid %d%s",
               tabled_srv.group, state_name_tdb[tabled_srv.state_tdb],
-              tabled_srv.ourhost, tabled_srv.rep_port, tdbrep.thisid,
+              tabled_srv.rep_name, tabled_srv.rep_port, tdbrep.thisid,
               (tabled_srv.mc_delay)? " mc_delay": "");
        for (tmp = tabled_srv.rep_remotes; tmp; tmp = tmp->next) {
                rp = tmp->data;
@@ -447,7 +447,7 @@ bool stat_status(struct client *cli, GList *content)
                     "<p>TDB: group %s "
                     "state %s host %s rep_port %d dbid %d%s</p>\r\n",
                     tabled_srv.group, state_name_tdb[tabled_srv.state_tdb],
-                    tabled_srv.ourhost, tabled_srv.rep_port, tdbrep.thisid,
+                    tabled_srv.rep_name, tabled_srv.rep_port, tdbrep.thisid,
                     (tabled_srv.mc_delay)? " mc_delay": "") < 0)
                return false;
        content = g_list_append(content, str);
@@ -1719,7 +1719,7 @@ int tdb_slave_login_cb(int srcid)
                if (rtdb_start(&tdbrep, tabled_srv.tdb_dir,
                               false,
                               master,
-                              tabled_srv.rep_port, tdb_state_cb)) {
+                              0, tdb_state_cb)) {
                        tabled_srv.state_tdb = ST_TDB_INIT;
                        applog(LOG_ERR, "Failed to open TDB, limping");
                        return -1;
@@ -2248,6 +2248,8 @@ int main (int argc, char *argv[])
        else if (debugging)
                applog(LOG_INFO, "Forcing local hostname to %s",
                       tabled_srv.ourhost);
+       if (!tabled_srv.rep_name)
+               tabled_srv.rep_name = tabled_srv.ourhost;
 
        /*
         * background outselves, write PID file ASAP
@@ -2294,7 +2296,7 @@ int main (int argc, char *argv[])
        }
 
        /* late-construct structures with allocations */
-       if (rtdb_init(&tdbrep, tabled_srv.ourhost)) {
+       if (rtdb_init(&tdbrep, tabled_srv.rep_name)) {
                applog(LOG_WARNING, "rtdb_init");
                rc = 1;
                goto err_rtdb;
--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to