Skip to content
Snippets Groups Projects
  • Andy Green's avatar
    2c218e70
    ah owns rxbuf · 2c218e70
    Andy Green authored
    
    This is intended to solve a longstanding problem with the
    relationship between http/1.1 keep-alive and the service
    loop.
    
    Ah now contain an rx buffer which is used during header
    processing, and the ah may not be detached from the wsi
    until the rx buffer is exhausted.
    
    Having the rx buffer in the ah means we can delay using the
    rx until a later service loop.
    
    Ah which have pending rx force POLLIN service on the wsi
    they are attached to automatically, so we can interleave
    general service / connections with draining each ah rx
    buffer.
    
    The possible http/1.1 situations and their dispositions are:
    
     1) exactly one set of http headers come.  After processing,
        the ah is detached since no pending rx left.  If more
        headers come later, a fresh ah is aqcuired when available
        and the rx flow control blocks the read until then.
    
     2) more that one whole set of headers come and we remain in
        http mode (no upgrade).  The ah is left attached and
        returns to the service loop after the first set of headers.
        We will get forced service due to the ah having pending
        content (respecting flowcontrol) and process the pending
        rx in the ah.  If we use it all up, we will detach the
        ah.
    
     3) one set of http headers come with ws traffic appended.
        We service the headers, do the upgrade, and keep the ah
        until the remaining ws content is used.  When we
        exhausted the ws traffix in the ah rx buffer, we
        detach the ah.
    
    Since there can be any amount of http/1.1 pipelining on a
    connection, and each may be expensive to service, it's now
    enforced there is a return to the service loop after each
    header set is serviced on a connection.
    
    When I added the forced service for ah with pending buffering,
    I added support for it to the windows plat code.  However this
    is untested.
    
    Signed-off-by: default avatarAndy Green <andy.green@linaro.org>
    2c218e70
    History
    ah owns rxbuf
    Andy Green authored
    
    This is intended to solve a longstanding problem with the
    relationship between http/1.1 keep-alive and the service
    loop.
    
    Ah now contain an rx buffer which is used during header
    processing, and the ah may not be detached from the wsi
    until the rx buffer is exhausted.
    
    Having the rx buffer in the ah means we can delay using the
    rx until a later service loop.
    
    Ah which have pending rx force POLLIN service on the wsi
    they are attached to automatically, so we can interleave
    general service / connections with draining each ah rx
    buffer.
    
    The possible http/1.1 situations and their dispositions are:
    
     1) exactly one set of http headers come.  After processing,
        the ah is detached since no pending rx left.  If more
        headers come later, a fresh ah is aqcuired when available
        and the rx flow control blocks the read until then.
    
     2) more that one whole set of headers come and we remain in
        http mode (no upgrade).  The ah is left attached and
        returns to the service loop after the first set of headers.
        We will get forced service due to the ah having pending
        content (respecting flowcontrol) and process the pending
        rx in the ah.  If we use it all up, we will detach the
        ah.
    
     3) one set of http headers come with ws traffic appended.
        We service the headers, do the upgrade, and keep the ah
        until the remaining ws content is used.  When we
        exhausted the ws traffix in the ah rx buffer, we
        detach the ah.
    
    Since there can be any amount of http/1.1 pipelining on a
    connection, and each may be expensive to service, it's now
    enforced there is a return to the service loop after each
    header set is serviced on a connection.
    
    When I added the forced service for ah with pending buffering,
    I added support for it to the windows plat code.  However this
    is untested.
    
    Signed-off-by: default avatarAndy Green <andy.green@linaro.org>