------------------------------------------------------------ revno: 12381 revision-id: squid3@treenet.co.nz-20121110041300-8xn3kvttaya96vg6 parent: squid3@treenet.co.nz-20121110040252-njww6vm5k04c87nc committer: Amos Jeffries branch nick: 3.3 timestamp: Fri 2012-11-09 21:13:00 -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-20121110041300-8xn3kvttaya96vg6 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: 5f58ff474b87a752a9fe8b22792cd91d6d422412 # timestamp: 2012-11-10 04:27:37 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20121110040252-\ # njww6vm5k04c87nc # # Begin patch === modified file 'src/comm.cc' --- src/comm.cc 2012-09-23 09:41:29 +0000 +++ src/comm.cc 2012-11-10 04:13:00 +0000 @@ -233,7 +233,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 @@ -362,7 +362,7 @@ bool comm_has_incomplete_write(int fd) { - assert(isOpen(fd)); + assert(isOpen(fd) && COMMIO_FD_WRITECB(fd)); return COMMIO_FD_WRITECB(fd)->active(); } @@ -1235,7 +1235,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); @@ -1264,7 +1264,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 @@ -1835,8 +1835,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 }