The branch, master has been updated
       via  7ae666d Add more connect debug info, as Carlos suggested.
      from  fbf4c26 Move freeaddrinfo() call after failure-reporting loop.

;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7ae666d2a76a5d116ddaefeeae42da92ba453583
Author: Wayne Davison <way...@samba.org>
Date:   Tue Jul 12 15:58:11 2011 -0700

    Add more connect debug info, as Carlos suggested.

-----------------------------------------------------------------------

Summary of changes:
 options.c |    4 ++--
 socket.c  |   12 ++++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/options.c b/options.c
index a8c5b49..6ba6669 100644
--- a/options.c
+++ b/options.c
@@ -206,7 +206,7 @@ static const char *debug_verbosity[] = {
        /*0*/ NULL,
        /*1*/ NULL,
        /*2*/ "BIND,CMD,CONNECT,DEL,DELTASUM,DUP,FILTER,FLIST,ICONV",
-       /*3*/ 
"ACL,BACKUP,DELTASUM2,DEL2,EXIT,FILTER2,FLIST2,FUZZY,GENR,OWN,RECV,SEND,TIME",
+       /*3*/ 
"ACL,BACKUP,CONNECT2,DELTASUM2,DEL2,EXIT,FILTER2,FLIST2,FUZZY,GENR,OWN,RECV,SEND,TIME",
        /*4*/ "CMD2,DELTASUM3,DEL3,EXIT2,FLIST3,ICONV2,OWN2,PROTO,TIME2",
        /*5*/ "CHDIR,DELTASUM4,FLIST4,FUZZY2,HASH,HLINK",
 };
@@ -267,7 +267,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = {
        DEBUG_WORD(BACKUP, W_REC, "Debug backup actions (levels 1-2)"),
        DEBUG_WORD(BIND, W_CLI, "Debug socket bind actions"),
        DEBUG_WORD(CHDIR, W_CLI|W_SRV, "Debug when the current directory 
changes"),
-       DEBUG_WORD(CONNECT, W_CLI, "Debug connection events"),
+       DEBUG_WORD(CONNECT, W_CLI, "Debug connection events (levels 1-2)"),
        DEBUG_WORD(CMD, W_CLI, "Debug commands+options that are issued (levels 
1-2)"),
        DEBUG_WORD(DEL, W_REC, "Debug delete actions (levels 1-3)"),
        DEBUG_WORD(DELTASUM, W_SND|W_REC, "Debug delta-transfer checksumming 
(levels 1-4)"),
diff --git a/socket.c b/socket.c
index 86e62f9..a43385e 100644
--- a/socket.c
+++ b/socket.c
@@ -297,10 +297,17 @@ int open_socket_out(char *host, int port, const char 
*bind_addr,
                        s = -1;
                        continue;
                }
+               if (DEBUG_GTE(CONNECT, 2)) {
+                       char buf[2048];
+                       if ((error = getnameinfo(res->ai_addr, res->ai_addrlen, 
buf, sizeof buf, NULL, 0, NI_NUMERICHOST) != 0))
+                               rprintf(FINFO, "error in getnameinfo: %s\n", 
gai_strerror(error));
+                       else
+                               rprintf(FINFO, "Connected to %s (%s)\n", h, 
buf);
+               }
                break;
        }
 
-       if (s < 0) {
+       if (s < 0 || DEBUG_GTE(CONNECT, 2)) {
                char buf[2048];
                for (res = res0, j = 0; res; res = res->ai_next, j++) {
                        if (errnos[j] == 0)
@@ -309,7 +316,8 @@ int open_socket_out(char *host, int port, const char 
*bind_addr,
                                strlcpy(buf, "*inet_ntop failed*", sizeof buf);
                        rsyserr(FERROR, errnos[j], "failed to connect to %s 
(%s)", h, buf);
                }
-               s = -1;
+               if (s < 0)
+                       s = -1;
        }
 
        freeaddrinfo(res0);


-- 
The rsync repository.
_______________________________________________
rsync-cvs mailing list
rsync-cvs@lists.samba.org
https://lists.samba.org/mailman/listinfo/rsync-cvs

Reply via email to