Skip to content
  • Eric Blake's avatar
    internal: Track traffic stats · e99fb4ef
    Eric Blake authored
    Increment statistics counters every time we send or receive bytes, as
    well as every time we send or receive a magic number delineating a
    portion of the data stream (the server's initial NBD_MAGIC,
    handshaking NBD_NEW_VERSION/NBD_OPT answered by one or more
    NBD_REP_MAGIC replies, and transmission NBD_REQUEST_MAGIC/NBD_CMD
    answered by NBD_SIMPLE_REPLY_MAGIC or one or more
    NBD_STRUCTURED_REPLY_MAGIC).  A later patch will then expose these
    statistics to the client application.
    
    Bytes is how many plaintext bytes we send for the NBD protocol (and
    NOT how many bytes are actually sent over the socket if TLS is
    enabled); and chunks is not an accurate count of nbd_* API calls, nor
    of actual TCP packets.  We will intentionally leave the documentation
    vague, to allow us to change what these values track if needed without
    breaking API.
    e99fb4ef