diff options
Diffstat (limited to 'src/IO')
-rw-r--r-- | src/IO/IO.c | 8 | ||||
-rw-r--r-- | src/IO/dpi.c | 32 | ||||
-rw-r--r-- | src/IO/http.c | 13 |
3 files changed, 20 insertions, 33 deletions
diff --git a/src/IO/IO.c b/src/IO/IO.c index adf4dbb4..a0e18226 100644 --- a/src/IO/IO.c +++ b/src/IO/IO.c @@ -27,10 +27,6 @@ #include "IO.h" #include "iowatch.hh" -#define DEBUG_LEVEL 5 -//#define DEBUG_LEVEL 1 -#include "../debug.h" - /* * Symbolic defines for shutdown() function * (Not defined in the same header file, for all distros --Jcid) @@ -174,7 +170,7 @@ static bool_t IO_read(IOData_t *io) bool_t ret = FALSE; int io_key = io->Key; - DEBUG_MSG(3, " IO_read\n"); + _MSG(" IO_read\n"); /* this is a new read-buffer */ dStr_truncate(io->Buf, 0); @@ -226,7 +222,7 @@ static bool_t IO_write(IOData_t *io) ssize_t St; bool_t ret = FALSE; - DEBUG_MSG(3, " IO_write\n"); + _MSG(" IO_write\n"); io->Status = 0; while (1) { diff --git a/src/IO/dpi.c b/src/IO/dpi.c index 33e5f730..54072a5f 100644 --- a/src/IO/dpi.c +++ b/src/IO/dpi.c @@ -40,10 +40,6 @@ #include "Url.h" #include "../../dpip/dpip.h" -/* #define DEBUG_LEVEL 2 */ -#define DEBUG_LEVEL 4 -#include "../debug.h" - /* This one is tricky, some sources state it should include the byte * for the terminating NULL, and others say it shouldn't. */ # define D_SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ @@ -309,7 +305,7 @@ static int Dpi_start_dpid(void) if (execl(path1, "dpid", NULL) == -1) { dFree(path1); if (execlp("dpid", "dpid", NULL) == -1) { - DEBUG_MSG(4, "Dpi_start_dpid (child): %s\n", dStrerror(errno)); + MSG("Dpi_start_dpid (child): %s\n", dStrerror(errno)); do n = write(st_pipe[1], "ERROR", 5); while (n == -1 && errno == EINTR); @@ -319,7 +315,7 @@ static int Dpi_start_dpid(void) } } else if (pid < 0) { /* The fork failed. Report failure. */ - DEBUG_MSG(4, "Dpi_start_dpid: %s\n", dStrerror(errno)); + MSG("Dpi_start_dpid: %s\n", dStrerror(errno)); /* close the unused pipe */ Dpi_close_fd(st_pipe[0]); Dpi_close_fd(st_pipe[1]); @@ -330,11 +326,11 @@ static int Dpi_start_dpid(void) do n = read(st_pipe[0], buf, 16); while (n == -1 && errno == EINTR); - DEBUG_MSG(2, "Dpi_start_dpid: n = %d\n", n); + _MSG("Dpi_start_dpid: n = %d\n", n); if (n != 5) { ret = 0; } else { - DEBUG_MSG(4, "Dpi_start_dpid: %s\n", dStrerror(errno)); + MSG("Dpi_start_dpid: %s\n", dStrerror(errno)); } } @@ -358,7 +354,7 @@ static int Dpi_check_uds(char *uds_name) if ((SockFD = socket(AF_LOCAL, SOCK_STREAM, 0)) == -1 || connect(SockFD, (void*)&pun, D_SUN_LEN(&pun)) == -1) { - DEBUG_MSG(4, "Dpi_check_uds: %s %s\n", dStrerror(errno), uds_name); + MSG("Dpi_check_uds: %s %s\n", dStrerror(errno), uds_name); } else { Dpi_close_fd(SockFD); ret = 0; @@ -448,8 +444,8 @@ static int Dpi_check_dpid(int num_tries) } dFree(dpid_uds_name); - DEBUG_MSG(2, "Dpi_check_dpid:: %s\n", - (ret == 0) ? "OK" : (ret == 1 ? "EAGAIN" : "ERROR")); + _MSG("Dpi_check_dpid:: %s\n", + (ret == 0) ? "OK" : (ret == 1 ? "EAGAIN" : "ERROR")); return ret; } @@ -485,7 +481,7 @@ static char *Dpi_get_server_uds_name(const char *server_name) int st; dReturn_val_if_fail (server_name != NULL, NULL); - DEBUG_MSG(2, "Dpi_get_server_uds_name:: server_name = [%s]\n", server_name); + _MSG("Dpi_get_server_uds_name:: server_name = [%s]\n", server_name); dpid_uds_dir = Dpi_get_dpid_uds_dir(); if (dpid_uds_dir) { @@ -505,7 +501,7 @@ static char *Dpi_get_server_uds_name(const char *server_name) perror("connect"); /* ask dpid to check the server plugin and send its UDS name back */ request = a_Dpip_build_cmd("cmd=%s msg=%s", "check_server", server_name); - DEBUG_MSG(2, "[%s]\n", request); + _MSG("[%s]\n", request); do st = write(sock, request, strlen(request)); while (st < 0 && errno == EINTR); @@ -532,7 +528,7 @@ static char *Dpi_get_server_uds_name(const char *server_name) strncat(rply, buf, (size_t)rdlen); } Dpi_close_fd(sock); - DEBUG_MSG(2, "rply = [%s]\n", rply); + _MSG("rply = [%s]\n", rply); /* Parse reply */ if (rdlen == 0 && rply) { @@ -545,7 +541,7 @@ static char *Dpi_get_server_uds_name(const char *server_name) } dFree(dpid_uds_dir); dFree(dpid_uds_name); - DEBUG_MSG(2, "Dpi_get_server_uds_name:: %s\n", server_uds_name); + _MSG("Dpi_get_server_uds_name:: %s\n", server_uds_name); return server_uds_name; } @@ -563,7 +559,7 @@ static int Dpi_connect_socket(const char *server_name, int retry) /* Query dpid for the UDS name for this server */ server_uds_name = Dpi_get_server_uds_name(server_name); - DEBUG_MSG(2, "server_uds_name = [%s]\n", server_uds_name); + _MSG("server_uds_name = [%s]\n", server_uds_name); if (access(server_uds_name, F_OK) != 0) { MSG("server socket was NOT found\n"); @@ -726,11 +722,11 @@ void a_Dpi_bye_dpid() sa.sun_family = AF_LOCAL; if ((new_socket = socket(AF_LOCAL, SOCK_STREAM, 0)) == -1) { - DEBUG_MSG(4, "a_Dpi_bye_dpid: %s\n", dStrerror(errno)); + MSG("a_Dpi_bye_dpid: %s\n", dStrerror(errno)); } strncpy(sa.sun_path, srs_name, sizeof (sa.sun_path)); if (connect(new_socket, (struct sockaddr *) &sa, addr_len) == -1) { - DEBUG_MSG(4, "a_Dpi_bye_dpid: %s\n", dStrerror(errno)); + MSG("a_Dpi_bye_dpid: %s\n", dStrerror(errno)); MSG("%s\n", sa.sun_path); } DpiBye_cmd = a_Dpip_build_cmd("cmd=%s", "DpiBye"); diff --git a/src/IO/http.c b/src/IO/http.c index 33236b52..03bb4522 100644 --- a/src/IO/http.c +++ b/src/IO/http.c @@ -47,11 +47,6 @@ D_STMT_START { \ #define _MSG_BW(web, root, ...) -#define DEBUG_LEVEL 5 -#include "../debug.h" - - - /* 'Url' and 'web' are just references (no need to deallocate them here). */ typedef struct { int SockFD; @@ -333,7 +328,7 @@ static int Http_connect_socket(ChainLink *Info) if ((S->SockFD = socket(dh->af, SOCK_STREAM, IPPROTO_TCP)) < 0) { S->Err = errno; - DEBUG_MSG(5, "Http_connect_socket ERROR: %s\n", dStrerror(errno)); + MSG("Http_connect_socket ERROR: %s\n", dStrerror(errno)); return -1; } /* set NONBLOCKING and close on exec. */ @@ -352,7 +347,7 @@ static int Http_connect_socket(ChainLink *Info) sin->sin_port = S->port ? htons(S->port) : htons(DILLO_URL_HTTP_PORT); memcpy(&sin->sin_addr, dh->data, (size_t)dh->alen); if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl)) - DEBUG_MSG(5, "Connecting to %s\n", inet_ntoa(sin->sin_addr)); + MSG("Connecting to %s\n", inet_ntoa(sin->sin_addr)); break; } #ifdef ENABLE_IPV6 @@ -366,7 +361,7 @@ static int Http_connect_socket(ChainLink *Info) memcpy(&sin6->sin6_addr, dh->data, dh->alen); inet_ntop(dh->af, dh->data, buf, sizeof(buf)); if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl)) - DEBUG_MSG(5, "Connecting to %s\n", buf); + MSG("Connecting to %s\n", buf); break; } #endif @@ -377,7 +372,7 @@ static int Http_connect_socket(ChainLink *Info) if (status == -1 && errno != EINPROGRESS) { S->Err = errno; Http_socket_close(S); - DEBUG_MSG(5, "Http_connect_socket ERROR: %s\n", dStrerror(S->Err)); + MSG("Http_connect_socket ERROR: %s\n", dStrerror(S->Err)); return -1; } else { Http_send_query(S->Info, S); |