Skip to content
  • Guillaume Roguez's avatar
    tls: remove unneeded atomic load · 168fe137
    Guillaume Roguez authored
    
    
    TlsSession state holder 'state_' is loaded twice
    when we check for its modification in the TlsSession
    state machine code.
    std::atomic_compare_exchange_strong returns false when
    'state_' is not equals to 'old_state' and in this case
    'old_state' is changed for the current value of 'state_'.
    So reload it right after the returns is not efficient
    and may also have an unexpected corner case.
    
    This patch re-uses the value of 'old_state' for next
    processing.
    
    Change-Id: Ia29abc0f5834caabf12f1ae528ff11b132bd603c
    Reviewed-by: default avatarStepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
    168fe137