9529cfc Ticket 50493 - connection_is_free to trylock

Authored and Committed by firstyear 4 years ago
    Ticket 50493 - connection_is_free to trylock
    
    Bug Description: Due to the nature of the connection table
    being single threaded, in connection_is_free, we would iterate
    over the CT attempting to lock and check connection free states.
    However, because this required the lock, if the connection was
    currently in io, or other operations, the ct would delay behind
    the c_mutex until it was released, then we would check the free
    state.
    
    Fix Description: Change the connection_is_free to use trylock
    instead of lock - this means if the connection is locked it's
    probably inuse and we can skip over it directly. We also change the
    fn to iterate over the ct twice to check for possible connections
    incase something frees up.
    
    https://pagure.io/389-ds-base/pull-request/50493
    
    Author: William Brown <william@blackhats.net.au>
    
    Review by: tbordaz (Thanks!)