--------------------- PatchSet 6436 Date: 2007/12/24 17:10:13 Author: chtsanti Branch: async-calls Tag: (none) Log: fixing a little the comm_read_cancel function. We should always call the AsyncCall::cancel method for canceled AsyncCalls Members: src/comm.cc:1.81.4.13->1.81.4.14 Index: squid3/src/comm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/comm.cc,v retrieving revision 1.81.4.13 retrieving revision 1.81.4.14 diff -u -r1.81.4.13 -r1.81.4.14 --- squid3/src/comm.cc 24 Dec 2007 16:46:50 -0000 1.81.4.13 +++ squid3/src/comm.cc 24 Dec 2007 17:10:13 -0000 1.81.4.14 @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.81.4.13 2007/12/24 16:46:50 chtsanti Exp $ + * $Id: comm.cc,v 1.81.4.14 2007/12/24 17:10:13 chtsanti Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -444,9 +444,22 @@ void comm_read_cancel(int fd, AsyncCall::Pointer &callback) { + callback->cancel("comm_read_cancel"); + + if (!isOpen(fd)) { + debugs(5, 4, "comm_read_cancel fails: FD " << fd << " closed"); + return; + } + comm_io_callback_t *cb = COMMIO_FD_READCB(fd); + + if (!cb->active()) { + debugs(5, 4, "comm_read_cancel fails: FD " << fd << " inactive"); + return; + } + AsyncCall::Pointer call = cb->callback; - assert(call != NULL); // XXX: will fail for AsyncJob calls; see XXX above. + assert(call != NULL); // XXX: should never fails (active() checks for callback==NULL) /* Ok, we can be reasonably sure we won't lose any data here! */ assert(call == callback);