--------------------- PatchSet 6356 Date: 2007/12/16 21:43:25 Author: chtsanti Branch: async-calls Tag: (none) Log: - Converting the comm_write* calls to new CommCalls design -The ICAPXaction::noteCommWrote function modified to be used with new CommCalls interface -The ICAPXaction_noteCommWrote function removed, not needed any more Members: src/ICAP/ICAPXaction.cc:1.22.4.8->1.22.4.9 src/ICAP/ICAPXaction.h:1.11.14.4->1.11.14.5 Index: squid3/src/ICAP/ICAPXaction.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ICAP/ICAPXaction.cc,v retrieving revision 1.22.4.8 retrieving revision 1.22.4.9 diff -u -r1.22.4.8 -r1.22.4.9 --- squid3/src/ICAP/ICAPXaction.cc 15 Dec 2007 16:02:42 -0000 1.22.4.8 +++ squid3/src/ICAP/ICAPXaction.cc 16 Dec 2007 21:43:25 -0000 1.22.4.9 @@ -41,15 +41,6 @@ ICAPXaction_fromData(data).noteCommClosed(); } -// XXX: This and similar wrappers used to handle exceptions and perform -// end-of-life checks. That code is now in AsyncCall. -// These wrappers will be gone once comm module supports AsyncCalls. -static -void ICAPXaction_noteCommWrote(int, char *, size_t size, comm_err_t status, int xerrno, void *data) -{ - ICAPXaction_fromData(data).noteCommWrote(status, size); -} - ICAPXaction::ICAPXaction(const char *aTypeName, ICAPInitiator *anInitiator, ICAPServiceRep::Pointer &aService): AsyncJob(aTypeName), ICAPInitiate(aTypeName, anInitiator, aService), @@ -208,12 +199,15 @@ void ICAPXaction::scheduleWrite(MemBuf &buf) { // comm module will free the buffer - writer = &ICAPXaction_noteCommWrote; - comm_write_mbuf(connection, &buf, writer, this); + typedef CommCbMemFunT Dialer; + writer = asyncCall(93,3, "ICAPXaction::noteCommWrote", + Dialer(this, &ICAPXaction::noteCommWrote)); + + comm_write_mbuf(connection, &buf, writer); updateTimeout(); } -void ICAPXaction::noteCommWrote(comm_err_t commStatus, size_t size) +void ICAPXaction::noteCommWrote(const CommIoCbParams &io) { Must(writer); writer = NULL; @@ -221,11 +215,11 @@ if (ignoreLastWrite) { // a hack due to comm inability to cancel a pending write ignoreLastWrite = false; - debugs(93, 7, HERE << "ignoring last write; status: " << commStatus); + debugs(93, 7, HERE << "ignoring last write; status: " << io.flag); } else { - Must(commStatus == COMM_OK); + Must(io.flag == COMM_OK); updateTimeout(); - handleCommWrote(size); + handleCommWrote(io.size); } } Index: squid3/src/ICAP/ICAPXaction.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ICAP/ICAPXaction.h,v retrieving revision 1.11.14.4 retrieving revision 1.11.14.5 diff -u -r1.11.14.4 -r1.11.14.5 --- squid3/src/ICAP/ICAPXaction.h 15 Dec 2007 16:02:42 -0000 1.11.14.4 +++ squid3/src/ICAP/ICAPXaction.h 16 Dec 2007 21:43:25 -0000 1.11.14.5 @@ -1,6 +1,6 @@ /* - * $Id: ICAPXaction.h,v 1.11.14.4 2007/12/15 16:02:42 chtsanti Exp $ + * $Id: ICAPXaction.h,v 1.11.14.5 2007/12/16 21:43:25 chtsanti Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -64,7 +64,7 @@ // comm handler wrappers, treat as private void noteCommConnected(const CommConnectCbParams &io); - void noteCommWrote(comm_err_t status, size_t sz); + void noteCommWrote(const CommIoCbParams &io); void noteCommRead(const CommIoCbParams &io); void noteCommTimedout(); void noteCommClosed(); @@ -139,7 +139,7 @@ // active (pending) comm callbacks for the ICAP server connection AsyncCall *connector; AsyncCall *reader; - IOCB *writer; + AsyncCall *writer; PF *closer; private: