player.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:piqueserver 作者: piqueserver 项目源码 文件源码
def on_connect(self):
        protocol = self.protocol
        client_ip = self.address[0]

        if client_ip in self.protocol.bans:
            name, reason, timestamp = self.protocol.bans[client_ip]

            if timestamp is not None and reactor.seconds() >= timestamp:
                protocol.remove_ban(client_ip)
                protocol.save_bans()
            else:
                print('banned user %s (%s) attempted to join' % (name,
                                                                 client_ip))
                self.disconnect(ERROR_BANNED)
                return

        manager = self.protocol.ban_manager

        if manager is not None:
            reason = manager.get_ban(client_ip)
            if reason is not None:
                print(('federated banned user (%s) attempted to join, '
                       'banned for %r') % (client_ip, reason))
                self.disconnect(ERROR_BANNED)
                return

        ServerConnection.on_connect(self)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号