def lost_connection(self, server, channel): ckey = channel.peername #自改abu为channel加上此属性,因socket已不可用,不能getpeername print 'lost a connection:%s' % str(ckey) if ckey in self.Clients: try: uid = self.Clients[ckey]['uid'] self.BM.destoryBattle(uid) #删除战斗 Gcore.onlineUser.pop(uid,None) Gcore.delUserStorage(uid) except Exception,e: print e finally:
def lost_connection(self, server, channel): ckey = channel.peername #自改abu为channel加上此属性,因socket已不可用,不能getpeername msg = 'lost a connection:%s' % str(ckey) comm.trace(msg) if ckey in self.Clients: try: #清空些用户的资料 uid = self.Clients[ckey]['uid'] if uid > 0: Gcore.getMod('Login', uid).logout() #更新 Gcore.onlineUser.pop(uid, None) #用户落线 Gcore.delUserStorage(uid) except Exception, e: print 'lost_connection >> ', e self.Clients.pop(ckey, None)
def lost_connection(self, server, channel): ckey = channel.peername #自改abu为channel加上此属性,因socket已不可用,不能getpeername msg = 'lost a connection:%s' % str(ckey) comm.trace(msg) if ckey in self.Clients: try: #清空些用户的资料 uid = self.Clients[ckey]['uid'] if uid: Gcore.getMod('Login', uid).logout() #更新 Gcore.onlineUser.pop(uid,None) #用户落线 Gcore.delUserStorage(uid) except Exception,e: print 'lost_connection >> ',e self.Clients.pop(ckey)