try:
del self.sessions[session['id']]
except:
pass
nothing happens because it throws exception which is happily ignored. This works:
try:
del self.sessions['client:' + session['id']]
except Exception, e:
log.info("!!!! del exception, %s" % e)
session["id"] doesn't contain "client" string, while self.sessions does contain
I think it would be good to at least handle KeyError and output something meaningful to the log. It is considered to be bad practice to catch all exceptions (even system) and ignore them.
https://github.com/fritzy/SleekXMPP/blob/master/sleekxmpp/plugins/xep_0050/adhoc.py#L596 Here it sets session id to "client:"+some_id
When it is time to remove session: https://github.com/fritzy/SleekXMPP/blob/master/sleekxmpp/plugins/xep_0050/adhoc.py#L571
nothing happens because it throws exception which is happily ignored. This works:
session["id"] doesn't contain "client" string, while self.sessions does contain
I think it would be good to at least handle KeyError and output something meaningful to the log. It is considered to be bad practice to catch all exceptions (even system) and ignore them.