Mercurial > dnsbl
diff src/dnsbl.cpp @ 92:505e77188317
optimize verification step, cleanup documentation
author | carl |
---|---|
date | Wed, 21 Sep 2005 08:00:08 -0700 |
parents | 962a1f8f1d9f |
children | e107ade3b1c0 |
line wrap: on
line diff
--- a/src/dnsbl.cpp Sun Sep 18 10:46:31 2005 -0700 +++ b/src/dnsbl.cpp Wed Sep 21 08:00:08 2005 -0700 @@ -392,8 +392,6 @@ syslog_opened = true; } syslog(LOG_NOTICE, "%s", text); - // closelog(); - // syslog_opened = false; pthread_mutex_unlock(&syslog_mutex); } else { @@ -434,7 +432,9 @@ } else { // peer closed the socket - //my_syslog("!!child worker process, peer closed socket while reading question"); + #ifdef RESOLVER_DEBUG + my_syslog("process_resolver_requests() peer closed socket while reading question"); + #endif shutdown(socket, SHUT_RDWR); close(socket); return; @@ -444,9 +444,11 @@ // find the answer #ifdef NS_PACKETSZ - //char text[1000]; - //snprintf(text, sizeof(text), "!!child worker process has a question %s", question); - //my_syslog(text); + #ifdef RESOLVER_DEBUG + char text[1000]; + snprintf(text, sizeof(text), "process_resolver_requests() has a question %s", question); + my_syslog(text); + #endif glom.length = res_search(question, ns_c_in, ns_t_a, glom.answer, sizeof(glom.answer)); if (glom.length < 0) glom.length = 0; // represent all errors as zero length answers #else @@ -461,8 +463,10 @@ // write the answer char *buf = (char *)&glom; int len = glom.length + sizeof(glom.length); - //snprintf(text, sizeof(text), "!!child worker process writing answer length %d for total %d", glom.length, len); - //my_syslog(text); + #ifdef RESOLVER_DEBUG + snprintf(text, sizeof(text), "process_resolver_requests() writing answer length %d for total %d", glom.length, len); + my_syslog(text); + #endif int ws = 0; while (len > ws) { int ns = write(socket, buf+ws, len-ws); @@ -471,7 +475,9 @@ } else { // peer closed the socket! - //my_syslog("!!child worker process, peer closed socket while writing answer"); + #ifdef RESOLVER_DEBUG + my_syslog("process_resolver_requests() peer closed socket while writing answer"); + #endif shutdown(socket, SHUT_RDWR); close(socket); return; @@ -498,9 +504,11 @@ char *buf = (char *)&glom; priv.my_read(buf, sizeof(glom.length)); buf += sizeof(glom.length); - ///char text[1000]; - ///snprintf(text, sizeof(text), "!!milter thread wrote question %s and has answer length %d", question, glom.length); - ///my_syslog(text); + #ifdef RESOLVER_DEBUG + char text[1000]; + snprintf(text, sizeof(text), "dns_interface() wrote question %s and has answer length %d", question, glom.length); + my_syslog(text); + #endif if ((glom.length < 0) || (glom.length > sizeof(glom.answer))) { priv.err = true; return 0; // cannot process overlarge answers