improve debug messages
authorTatsuo Ishii <ishii at sraoss.co.jp>
Wed, 16 Mar 2005 15:13:29 +0000 (15:13 +0000)
committerTatsuo Ishii <ishii at sraoss.co.jp>
Wed, 16 Mar 2005 15:13:29 +0000 (15:13 +0000)
pool_auth.c

index 7ca499d27074ae982e3e7cfbb86d78070987ecac..7c919f68413432a92582c6028c1fa2878ef98eaf 100644 (file)
@@ -109,6 +109,8 @@ int pool_do_auth(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp)
                return -1;
        }
 
+       pid = ntohl(pid);
+
        if (DUAL_MODE)
        {
                status = pool_read(SECONDARY(cp), &pid1, sizeof(pid1));
@@ -118,9 +120,15 @@ int pool_do_auth(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp)
                        pool_error("pool_do_auth: read authentication kind from secondary failed");
                        return -1;
                }
-       }
 
-       pid = ntohl(pid);
+               pid1 = ntohl(pid1);
+
+               if (pid != pid1)
+               {
+                       pool_error("pool_do_auth: authentication kind does not match between master(%d) and secondary(%d)", pid, pid1);
+                       return -1;
+               }
+       }
 
        /* trust? */
        if (pid == 0)
@@ -205,7 +213,7 @@ int pool_do_auth(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *cp)
                        SimpleForwardToFrontend(kind, frontend, cp);
                return -1;
        }
-       else if (kind != 'K')
+       else if (kind != 'K')           /* BackendKeyData? */
        {
                if (protoMajor == PROTO_MAJOR_V3)
                {
@@ -895,7 +903,7 @@ signed char pool_read_kind(POOL_CONNECTION_POOL *cp)
        status = pool_read(MASTER(cp), &kind, sizeof(kind));
        if (status < 0)
        {
-               pool_error("read_message_kind: error while reading message kind");
+               pool_error("read_kind: error while reading message kind");
                return -1;
        }
 
@@ -904,13 +912,13 @@ signed char pool_read_kind(POOL_CONNECTION_POOL *cp)
                status = pool_read(SECONDARY(cp), &kind1, sizeof(kind1));
                if (status < 0)
                {
-                       pool_error("read_message_kind: error while reading message kind from secondary backend");
+                       pool_error("read_kind: error while reading message kind from secondary backend");
                        return -1;
                }
 
                if (kind != kind1)
                {
-                       pool_error("read_message_kind: kind does not match between backends master(%d) secondary(%d)",
+                       pool_error("read_kind: kind does not match between backends master(%d) secondary(%d)",
                                           kind, kind1);
                        return -1;
                }