/*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",
};
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)"),
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)
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);