7ff19c6 Ticket 48184 - clean up and delete connections at shutdown (3rd)

Authored and Committed by tbordaz 6 years ago
    Ticket 48184 - clean up and delete connections at shutdown (3rd)
    
    Bug description:
            During shutdown we would not close connections.
            In the past this may have just been an annoyance, but now with the way
            nunc-stans works, io events can still trigger on open xeisting connectinos
            during shutdown.
    
    Fix Description:
            Because of NS dynamic it can happen that several jobs wants to work on the
            same connection. In such case (a job is already set in c_job) we delay the
            new job that will retry.
            In addition:
                - some call needed c_mutex
                - test uninitialized nunc-stans in case of shutdown while startup is not completed
    
    	If it is not possible to schedule immediately a job it is sometime useless to wait:
    		- if the connection is already freed, just cancel the scheduled job
    		  and do not register a new one
    		- If we are in middle of a shutdown we do not know if the
    		  scheduled job is ns_handle_closure, so cancel the scheduled
    		  job and schedule ns_handle_closure.
    
    https://pagure.io/389-ds-base/issue/48184
    
    Reviewed by:
                Original fix reviewed by Ludwig and Viktor
                Second   fix reviewed by Mark
    	    Third    fix reviewed by Mark
    
    Platforms tested: F26
    
    Flag Day: no
    
    Doc impact: no
    
        
file modified
+51 -16