return false;
// shuffle the remaining entries to fill the new gap.
- for (; index < size_ - 2; index++)
+ for (; index < size_ - 1; index++)
theList_[index] = theList_[index + 1];
- theList_[size_-1] = NULL;
+ theList_[--size_] = NULL;
if (parent_) {
parent_->noteConnectionRemoved();
+ if (size_ == 0) {
+ debugs(48, 3, HERE << "deleting " << hashKeyStr(&hash));
+ delete this;
+ }
}
- if (--size_ == 0) {
- debugs(48, 3, HERE << "deleting " << hashKeyStr(&hash));
- delete this;
- }
return true;
}
} else if (n < (size_t)count()) {
debugs(48, 2, HERE << "Closing all entries.");
while (size_ >= 0) {
- const Comm::ConnectionPointer &conn = theList_[--size_];
+ const Comm::ConnectionPointer conn = theList_[--size_];
theList_[size_] = NULL;
clearHandlers(conn);
conn->close();
size_t index = 0;
// ensure the first N entries are closed
while (index < n) {
- const Comm::ConnectionPointer &conn = theList_[--size_];
+ const Comm::ConnectionPointer conn = theList_[--size_];
theList_[size_] = NULL;
clearHandlers(conn);
conn->close();
AsyncCall::Pointer readCall = commCbCall(5,4, "IdleConnList::Read",
CommIoCbPtrFun(IdleConnList::Read, this));
comm_read(conn, fakeReadBuf_, sizeof(fakeReadBuf_), readCall);
- AsyncCall::Pointer timeoutCall = commCbCall(5,4, "IdleConnList::Read",
+ AsyncCall::Pointer timeoutCall = commCbCall(5,4, "IdleConnList::Timeout",
CommTimeoutCbPtrFun(IdleConnList::Timeout, this));
commSetConnTimeout(conn, Config.Timeout.pconn, timeoutCall);
}
// this flag is set while our early-read/close handler is
// waiting for a remote response. It gets unset when the
// handler is scheduled.
- if (!fd_table[theList_[i]->fd].flags.read_pending)
- continue;
+ //The following check is disabled for now until we have a
+ // correct implementation of the read_pending flag
+ //if (!fd_table[theList_[i]->fd].flags.read_pending)
+ // continue;
// connection already closed. useless.
if (!Comm::IsConnOpen(theList_[i]))
Comm::ConnectionPointer result = theList_[i];
/* may delete this */
removeAt(i);
+ clearHandlers(result);
return result;
}
// this flag is set while our early-read/close handler is
// waiting for a remote response. It gets unset when the
// handler is scheduled.
- if (!fd_table[theList_[i]->fd].flags.read_pending)
- continue;
+ //The following check is disabled for now until we have a
+ // correct implementation of the read_pending flag
+ //if (!fd_table[theList_[i]->fd].flags.read_pending)
+ // continue;
// connection already closed. useless.
if (!Comm::IsConnOpen(theList_[i]))
Comm::ConnectionPointer result = theList_[i];
/* may delete this */
removeAt(i);
+ clearHandlers(result);
return result;
}