Example #1
0
def shutdown():
    global _WSGIListener
    global _WSGIPort
    if _Debug:
        lg.out(_DebugLevel, 'control.shutdown')
    from chat import message
    message.RemoveIncomingMessageCallback(dbwrite.incoming_message)
    # sqlio.shutdown()
    # shortpool.shutdown()
    if _WSGIListener:
        if _Debug:
            lg.out(_DebugLevel, '    close listener %s' % _WSGIListener)
        try:
            result = _WSGIListener.stopListening()
        except:
            lg.exc()
        try:
            _WSGIListener.connectionLost("Closing WSGIListener as requested")
        except:
            lg.exc()
        del _WSGIListener
    else:
        if _Debug:
            lg.out(_DebugLevel, '    listener is None')
        result = Deferred()
        result.callback(1)
    _WSGIListener = None
    _WSGIPort = None
    return result
Example #2
0
def shutdown():
    lg.out(4, "message_keeper.shutdown")
    message.RemoveIncomingMessageCallback(on_incoming_message)
    message.RemoveOutgoingMessageCallback(on_outgoing_message)