def close_session(self, authkey):
session = self.sessions[authkey] # (Session, RemoteSession) tuple
released = []
# loop through share allocators
for a in self.allocators:
allocator = self.allocators[a]
released.extend(self.allocators[a].close_session(session))
try:
session[LOCAL].terminate() # don't bother being nice.
except OSError, e:
if e.errno not in [errno.ECHILD, errno.ESRCH]:
raise Exception('unhandled errno: %d' % e.errno)
del self.sessions[authkey]
# re-add released resources to the remote master broker if this broker
# is configured to share
if released and self.is_sharing():
self.update_sharing()
if not self.allocating:
# handover in progress. shut down when no sessions with allocations
# remain
if not self.sessions:
self.shutdown(Exit('broker restarted. please reconnect'))
评论列表
文章目录