------------------------------------------------------------ revno: 11699 revision-id: squid3@treenet.co.nz-20121110043832-baks2wqz1pej3zgc parent: squid3@treenet.co.nz-20121110043729-xqf2btt96xgqjut6 committer: Amos Jeffries branch nick: 3.2 timestamp: Fri 2012-11-09 21:38:32 -0700 message: 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 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20121110043832-baks2wqz1pej3zgc # target_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # testament_sha1: 909a1d479b4e3d4ae6bd3b1f7795ce71a716462b # timestamp: 2012-11-10 04:40:03 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # base_revision_id: squid3@treenet.co.nz-20121110043729-\ # xqf2btt96xgqjut6 # # Begin patch === modified file 'src/comm.cc' --- src/comm.cc 2012-07-28 05:38:50 +0000 +++ src/comm.cc 2012-11-10 04:38:32 +0000 @@ -221,7 +221,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 }