bool
CommIoCbParams::syncWithComm()
{
+ // transition only: read/write legacy code does not know about conn, it just sets FD
+ if (fd >= 0) {
+ if (conn == NULL)
+ conn = new Comm::Connection;
+ if (conn->fd != fd)
+ conn->fd = fd;
+ }
+
// change parameters if the call was scheduled before comm_close but
// is being fired after comm_close
- if (fd >= 0 && fd_table[fd].closing() && flag != COMM_ERR_CLOSING) {
- debugs(5, 3, HERE << "converting late call to COMM_ERR_CLOSING: FD " << fd);
+ if (conn->fd >= 0 && fd_table[conn->fd].closing() && flag != COMM_ERR_CLOSING) {
+ debugs(5, 3, HERE << "converting late call to COMM_ERR_CLOSING: " << conn);
flag = COMM_ERR_CLOSING;
size = 0;
}
void
CommIoCbPtrFun::dial()
{
- handler(params.fd, params.buf, params.size, params.flag, params.xerrno, params.data);
+ handler(params.conn, params.buf, params.size, params.flag, params.xerrno, params.data);
}
void
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);
+typedef void IOCB(const Comm::ConnectionPointer &conn, char *, size_t size, comm_err_t flag, int xerrno, void *data);
/*
* TODO: When there are no function-pointer-based callbacks left, all
inline CommCbFunPtrCallT(int debugSection, int debugLevel,
const char *callName, const Dialer &aDialer);
+// XXX: obsolete comment?
// parameter cannot be const because getDialer() cannot be const
// getDialer() cannot because Comm IO syncWithComm() alters the object params data
inline CommCbFunPtrCallT(const Pointer &p) :
public:
CallSubscription(const RefCount<Call_> &aCall) : call(aCall) {};
+// XXX: obsolete comment?
// cant be const sometimes because CommCbFunPtrCallT cant provide a const overload.
// CommCbFunPtrCallT lists why. boils down to Comm IO syncWithComm() existence
// NP: we still treat it as const though.