/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2016-06-03 17:27:03 UTC
  • Revision ID: teddy@recompile.se-20160603172703-mc6tjor6rhq4xy74
mandos: Bug fix: Do multiprocessing cleanup correctly on exit

* mandos (main): Save module "multiprocessing" and open file "wnull"
                 as scope variables accessible by function cleanup(),
                 since the module and global variable may not be
                 accessible when the cleanup() function is run as
                 scheduled by atexit().

Show diffs side-by-side

added added

removed removed

Lines of Context:
3309
3309
        
3310
3310
        mandos_dbus_service = MandosDBusService()
3311
3311
    
 
3312
    # Save modules to variables to exempt the modules from being
 
3313
    # unloaded before the function registered with atexit() is run.
 
3314
    mp = multiprocessing
 
3315
    wn = wnull
3312
3316
    def cleanup():
3313
3317
        "Cleanup function; run on exit"
3314
3318
        if zeroconf:
3315
3319
            service.cleanup()
3316
3320
        
3317
 
        multiprocessing.active_children()
3318
 
        wnull.close()
 
3321
        mp.active_children()
 
3322
        wn.close()
3319
3323
        if not (tcp_server.clients or client_settings):
3320
3324
            return
3321
3325