From: wessels <> Date: Wed, 18 Jun 1997 09:06:48 +0000 (+0000) Subject: debugging and assertions X-Git-Tag: SQUID_3_0_PRE1~4930 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=489b22c1ec56bcd3a930dd8d4f862fd305f490da;p=thirdparty%2Fsquid.git debugging and assertions --- diff --git a/src/comm.cc b/src/comm.cc index b4efd9f958..117195d025 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.165 1997/06/18 01:43:42 wessels Exp $ + * $Id: comm.cc,v 1.166 1997/06/18 03:06:48 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -280,6 +280,7 @@ comm_open(int sock_type, return (COMM_ERROR); } /* update fdstat */ + debug(5,5)("comm_open: FD %d is a new socket\n", new_socket); fd_open(new_socket, FD_SOCKET, note); fde = &fd_table[new_socket]; if (!BIT_TEST(flags, COMM_NOCLOEXEC)) @@ -416,6 +417,7 @@ commConnectHandle(int fd, void *data) } switch (comm_connect_addr(fd, &cs->S)) { case COMM_INPROGRESS: + debug(5, 5) ("FD %d: COMM_INPROGRESS\n", fd); commSetSelect(fd, COMM_SELECT_WRITE, commConnectHandle, cs, 0); break; case COMM_OK: @@ -473,15 +475,10 @@ comm_connect_addr(int sock, const struct sockaddr_in *address) FD_ENTRY *fde = &fd_table[sock]; int len; int x; - /* sanity check */ - if (ntohs(address->sin_port) == 0) { - debug(5, 10) ("comm_connect_addr: %s:%d: URL uses port 0?\n", - inet_ntoa(address->sin_addr), ntohs(address->sin_port)); - errno = 0; - return COMM_ERROR; - } + assert(ntohs(address->sin_port) != 0); /* Establish connection. */ if (connect(sock, (struct sockaddr *) address, sizeof(struct sockaddr_in)) < 0) { + debug(5,9)("connect FD %d: %s\n", sock, xstrerror()); switch (errno) { case EALREADY: #if EAGAIN != EWOULDBLOCK @@ -1087,9 +1084,9 @@ void commSetSelect(int fd, unsigned int type, PF * handler, void *client_data, time_t timeout) { FD_ENTRY *fde; - if (fd < 0) - fatal_dump("commSetSelect: bad FD"); + assert(fd >= 0); fde = &fd_table[fd]; + debug(5,5)("commSetSelect: FD %d, handler=%p, data=%p\n", fd, handler, client_data); if (type & COMM_SELECT_READ) { fde->read_handler = handler; fde->read_data = client_data; diff --git a/src/disk.cc b/src/disk.cc index e818adb4b9..526e8b34c0 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -1,5 +1,5 @@ /* - * $Id: disk.cc,v 1.73 1997/06/04 06:15:50 wessels Exp $ + * $Id: disk.cc,v 1.74 1997/06/18 03:06:49 wessels Exp $ * * DEBUG: section 6 Disk I/O Routines * AUTHOR: Harvest Derived @@ -192,6 +192,7 @@ file_open_complete(void *data, int fd, int errcode) xfree(ctrlp); return; } + debug(6,5)("file_open: FD %d\n", fd); commSetCloseOnExec(fd); fd_open(fd, FD_FILE, ctrlp->path); fde = &fd_table[fd]; @@ -217,6 +218,7 @@ file_close(int fd) return; } fd_close(fd); + debug(6,5)("file_close: FD %d\n", fd); #if USE_ASYNC_IO aioClose(fd); #else