From: Amos Jeffries Date: Sat, 10 Nov 2012 04:38:32 +0000 (-0700) Subject: Polish: replace several assert(isOpen(fd)) X-Git-Tag: SQUID_3_2_4~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33b1172380db5738f04026525d3f8b96af7cdba3;p=thirdparty%2Fsquid.git Polish: replace several assert(isOpen(fd)) Reduces by over half the number of asserts which can be confused as cache.log bug reports just says "assertion isOpen(fd)" in comm.cc --- diff --git a/src/comm.cc b/src/comm.cc index ace7f7b09f..3f3238dfc2 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -221,7 +221,7 @@ comm_has_pending_read_callback(int fd) bool comm_monitors_read(int fd) { - assert(isOpen(fd)); + assert(isOpen(fd) && COMMIO_FD_READCB(fd)); // Being active is usually the same as monitoring because we always // start monitoring the FD when we configure Comm::IoCallback for I/O // and we usually configure Comm::IoCallback for I/O when we starting @@ -352,7 +352,7 @@ comm_udp_send(int s, const void *buf, size_t len, int flags) bool comm_has_incomplete_write(int fd) { - assert(isOpen(fd)); + assert(isOpen(fd) && COMMIO_FD_WRITECB(fd)); return COMMIO_FD_WRITECB(fd)->active(); } @@ -1227,7 +1227,7 @@ comm_add_close_handler(int fd, AsyncCall::Pointer &call) void comm_remove_close_handler(int fd, CLCB * handler, void *data) { - assert (isOpen(fd)); + assert(isOpen(fd)); /* Find handler in list */ debugs(5, 5, "comm_remove_close_handler: FD " << fd << ", handler=" << handler << ", data=" << data); @@ -1256,7 +1256,7 @@ comm_remove_close_handler(int fd, CLCB * handler, void *data) void comm_remove_close_handler(int fd, AsyncCall::Pointer &call) { - assert (isOpen(fd)); + assert(isOpen(fd)); debugs(5, 5, "comm_remove_close_handler: FD " << fd << ", AsyncCall=" << call); // comm_close removes all close handlers so our handler may be gone @@ -1829,8 +1829,7 @@ void commStartHalfClosedMonitor(int fd) { debugs(5, 5, HERE << "adding FD " << fd << " to " << *TheHalfClosed); - assert(isOpen(fd)); - assert(!commHasHalfClosedMonitor(fd)); + assert(isOpen(fd) && !commHasHalfClosedMonitor(fd)); (void)TheHalfClosed->add(fd); // could also assert the result commPlanHalfClosedCheck(); // may schedule check if we added the first FD }