~kinkie/squid/domaindata-benchmark

Viewing all changes in revision 13442.

  • Committer: Amos Jeffries
  • Date: 2014-06-05 08:28:20 UTC
  • Revision ID: squid3@treenet.co.nz-20140605082820-9th5ecz7lb7rfim9
Update the Comm:: API for read(2)

... using an algorithm suggested by Alex Rousskov.

The code for Comm:: read operations is shuffled into comm/libcomm.la and
the files comm/Read.{h,cc} in symmetry with the current Comm::Write API.


The new API consists of:

 * Comm::Read() which accepts the Comm::Connection pointer for the
socket to read on and an AsyncCall callback to be run when read is
ready. The Job is responsible for separately initiating read(2) or
alternative action when that callback is run.

 * Comm::ReadNow() which accepts an SBuf buffer and a CommIoCbParams
initialized to contain the Comm::Connection pointer for the socket to
read on. TheCommIoCbParams will be filled out with result flag, xerrno,
and size.
This synchronously performs read(2) operations to append bytes to the
provided buffer. It returns a comm_err_t flag for use in determining how
to handle the results and signalling one of OK, INPROGRESS, ERROR, EOF
as having happened.

comm_read() API is retained for backward compatibility during the
transitional period. However it is now deprecated and scheduled for
removal ASAP. The SBuf overloaded variant is now removed.


 * Comm::ReadCancel() - a renaming of the comm_read_cancel() AsyncCall
API. Other cancel API(s) are now deprecated and will be removed ASAP.

Code using comm_read_cancel() with AsyncCall may immediately switch to
this new API with no logic changes necessary even if they are not using
other new Comm API calls.


 * Comm::MonitorsRead() - a renaming of comm_monitors_read() AsyncCall
API. comm_monitors_read() is now removed.



Other changes:
 - the unused comm_has_pending_read_callback() API is erased.
 - the IoCallback::buf2 mechanism previously used for SBuf read I/O is
   erased.
 - ConnStateData is converted to this new API for filling its SBuf I/O
   buffer and for monitoring pinned connection closures.
 - fde::readPending() converted to new Comm::MonitorsRead() API.
 - Comm half-closed monitoring feature is also converted to this new API.

NP: one bug in ConnStateData handling of intercepted HTTPS traffic is
noted but not fixed in this patch.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: