]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Remove redundant accept params. add costructors for subscriptions
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 11 Sep 2010 03:33:44 +0000 (15:33 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 11 Sep 2010 03:33:44 +0000 (15:33 +1200)
src/CommCalls.cc
src/CommCalls.h

index fd5a14a5995557f755ce684f3251fc5f07f77258..de063ea07cfcbe3b401795e0effb2f944f5950e7 100644 (file)
@@ -39,21 +39,11 @@ CommCommonCbParams::print(std::ostream &os) const
 
 /* CommAcceptCbParams */
 
-CommAcceptCbParams::CommAcceptCbParams(void *aData): CommCommonCbParams(aData),
-        nfd(-1)
+CommAcceptCbParams::CommAcceptCbParams(void *aData):
+        CommCommonCbParams(aData)
 {
 }
 
-void
-CommAcceptCbParams::print(std::ostream &os) const
-{
-    CommCommonCbParams::print(os);
-    if (nfd >= 0)
-        os << ", newFD " << nfd;
-    if (details != NULL)
-        os << ", " << details;
-}
-
 
 /* CommConnectCbParams */
 
@@ -129,10 +119,16 @@ CommAcceptCbPtrFun::CommAcceptCbPtrFun(IOACB *aHandler,
 {
 }
 
+CommAcceptCbPtrFun::CommAcceptCbPtrFun(const CommAcceptCbPtrFun &o):
+        CommDialerParamsT<CommAcceptCbParams>(o.params),
+        handler(o.handler)
+{
+}
+
 void
 CommAcceptCbPtrFun::dial()
 {
-    handler(params.fd, params.nfd, params.details, params.flag, params.xerrno, params.data);
+    handler(params.fd, params.conn, params.flag, params.xerrno, params.data);
 }
 
 void
index cff7d5a5ad50d033067d973a2295a59226463f29..e44d33caa524da877fac172050ff026462951792 100644 (file)
@@ -21,7 +21,7 @@
  *     - I/O (IOCB).
  */
 
-typedef void IOACB(int fd, int nfd, Comm::ConnectionPointer &details, comm_err_t flag, int xerrno, void *data);
+typedef void IOACB(int fd, const Comm::ConnectionPointer &details, comm_err_t flag, int xerrno, void *data);
 typedef void CNCB(const Comm::ConnectionPointer &conn, comm_err_t status, int xerrno, void *data);
 typedef void IOCB(int fd, char *, size_t size, comm_err_t flag, int xerrno, void *data);
 
@@ -69,12 +69,6 @@ class CommAcceptCbParams: public CommCommonCbParams
 {
 public:
     CommAcceptCbParams(void *aData);
-
-    void print(std::ostream &os) const;
-
-public:
-    Comm::ConnectionPointer details;
-    int nfd; // TODO: rename to fdNew or somesuch
 };
 
 // connect parameters
@@ -175,10 +169,12 @@ class CommAcceptCbPtrFun: public CallDialer,
 {
 public:
     typedef CommAcceptCbParams Params;
+    typedef RefCount<CommAcceptCbPtrFun> Pointer;
 
     CommAcceptCbPtrFun(IOACB *aHandler, const CommAcceptCbParams &aParams);
-    void dial();
+    CommAcceptCbPtrFun(const CommAcceptCbPtrFun &o);
 
+    void dial();
     virtual void print(std::ostream &os) const;
 
 public:
@@ -258,11 +254,16 @@ template <class Dialer>
 class CommCbFunPtrCallT: public AsyncCall
 {
 public:
+    typedef RefCount<CommCbFunPtrCallT<Dialer> > Pointer;
     typedef typename Dialer::Params Params;
 
     inline CommCbFunPtrCallT(int debugSection, int debugLevel,
                              const char *callName, const Dialer &aDialer);
 
+    // parameter cannot be const because getDialer() cannot be const
+    // getDialer() cannot because Comm IO syncWithComm() alters the object params data
+    inline CommCbFunPtrCallT(Pointer &p) : dialer(*dynamic_cast<Dialer*>(p->getDialer())) {}
+
     virtual CallDialer* getDialer() { return &dialer; }
 
 public: