]> git.ipfire.org Git - thirdparty/squid.git/commit
Refactored and probably sped up ServerBio reading.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 13 Apr 2016 05:40:24 +0000 (23:40 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 13 Apr 2016 05:40:24 +0000 (23:40 -0600)
commita465cd53b3676cbdea3cda63cb81a9eff43665b4
tree97ff28e93bd00270cbbcfd9c026def9773914ac2
parent7f6e3bc5061a2727fdf209c5a503b3a73dcf6b81
Refactored and probably sped up ServerBio reading.

I could not grok the logic of the ServerBio::read*() methods and
saw strange cache.log message sequences like this:

  | bio.cc(121) read: FD 13 read -1 <= 65535
  | bio.cc(126) read: error: 11 ignored: 1
  | bio.cc(139) readAndBuffer: read -1 bytes
  | bio.cc(266) read: Pass 5 bytes to openSSL as read
  | bio.cc(121) read: FD 13 read -1 <= 65535
  | bio.cc(126) read: error: 11 ignored: 1
  | bio.cc(139) readAndBuffer: read -1 bytes
  | bio.cc(266) read: Pass 4 bytes to openSSL as read

Initially, they looked like we were [incorrectly] subtracting -1 from
some buffer length (read -1, pass 5; read -1, pass 4). Now, I believe
they [just] indicated unnecessary network reads. The fixed sequence
looks similar to this (note no network reads):

  | bio.cc(289) giveBuffered: Pass 5 read bytes to openSSL
  | bio.cc(289) giveBuffered: Pass 4 read bytes to openSSL

The refactored ServerBio code starts in "parsing" state (SSL Hello
parsing is the primary ServerBio functionality). Only when that parsing
is over, ServerBio starts feeding OpenSSL with received bytes. This
internal logic allows us to hide parsing from callers and avoid the
confusing public holdRead API.
src/ssl/PeerConnector.cc
src/ssl/bio.cc
src/ssl/bio.h