* When performing a network poll of another Citadel node, connecting to a node other...
authorArt Cancro <ajc@citadel.org>
Thu, 5 Nov 2009 18:00:00 +0000 (18:00 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 5 Nov 2009 18:00:00 +0000 (18:00 +0000)
citadel/modules/network/serv_network.c

index b289851dc979264281a14c5c0a8bdb2283a8100a..0f1d371834cd942a58c4834bf612898fa666b318 100644 (file)
@@ -2028,22 +2028,24 @@ void network_poll_node(char *node, char *secret, char *host, char *port) {
        if (strcmp(connected_to, node))
        {
                snprintf (err_buf, sizeof(err_buf), "Connected to node \"%s\" but I was expecting to connect to node \"%s\".", connected_to, node);
-               CtdlAideMessage(err_buf, "IGNet Networking error.");
+               CtdlLogPrintf(CTDL_ERR, "%s\n", err_buf);
+               CtdlAideMessage(err_buf, "Network error");
+       }
+       else {
+               /* We're talking to the correct node.  Now identify ourselves. */
+               snprintf(buf, sizeof buf, "NETP %s|%s", config.c_nodename, secret);
+               CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
+               if (sock_puts(sock, buf) <0) goto bail;
+               if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
+               CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
+               if (buf[0] != '2') goto bail;
+       
+               /* At this point we are authenticated. */
+               if (!CtdlThreadCheckStop())
+                       receive_spool(sock, node);
+               if (!CtdlThreadCheckStop())
+                       transmit_spool(sock, node);
        }
-
-       /* Identify ourselves */
-       snprintf(buf, sizeof buf, "NETP %s|%s", config.c_nodename, secret);
-       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
-       if (sock_puts(sock, buf) <0) goto bail;
-       if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
-       CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
-       if (buf[0] != '2') goto bail;
-
-       /* At this point we are authenticated. */
-       if (!CtdlThreadCheckStop())
-               receive_spool(sock, node);
-       if (!CtdlThreadCheckStop())
-               transmit_spool(sock, node);
 
        sock_puts(sock, "QUIT");
 bail:  sock_close(sock);